diff options
author | Andreas Schneider <asn@samba.org> | 2018-11-12 15:47:46 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2018-11-13 07:37:25 +0100 |
commit | 63a9fe1d445f04eb83a7d0f9d27355c2baf9c5bf (patch) | |
tree | f48a3d590cd83ffbeeb6b779b1225064eeb37072 /nsswitch | |
parent | 7a9d003d01adebaf089ca975b04b9d8d4e7640a2 (diff) | |
download | samba-63a9fe1d445f04eb83a7d0f9d27355c2baf9c5bf.tar.gz |
nsswitch: Handle possible NULL return value of getprogname()
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Diffstat (limited to 'nsswitch')
-rw-r--r-- | nsswitch/wb_common.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/nsswitch/wb_common.c b/nsswitch/wb_common.c index 6eea32c7e2a..f2672fb1298 100644 --- a/nsswitch/wb_common.c +++ b/nsswitch/wb_common.c @@ -89,14 +89,19 @@ void winbind_set_client_name(const char *name) static const char *winbind_get_client_name(void) { if (client_name[0] == '\0') { + const char *progname = getprogname(); int len; + if (progname == NULL) { + progname = "<unknown>"; + } + len = snprintf(client_name, sizeof(client_name), "%s", - getprogname()); + progname); if (len <= 0) { - return "<unkonwn>"; + return progname; } } |