1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

s3/smbstatus: add a NULL check

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Ralph Boehme 2017-11-22 10:43:19 +01:00 committed by Jeremy Allison
parent aace1f8345
commit eb6dd7dc29

View File

@ -386,7 +386,12 @@ static int traverse_sessionid(const char *key, struct sessionid *session,
if (numeric_only) {
fstr_sprintf(uid_str, "%u", (unsigned int)session->uid);
} else {
fstrcpy(uid_str, uidtoname(session->uid));
const char *uid_name = uidtoname(session->uid);
if (uid_name == NULL) {
return -1;
}
fstrcpy(uid_str, uid_name);
}
}
@ -396,6 +401,11 @@ static int traverse_sessionid(const char *key, struct sessionid *session,
if (numeric_only) {
fstr_sprintf(gid_str, "%u", (unsigned int)session->gid);
} else {
const char *gid_name = gidtoname(session->gid);
if (gid_name == NULL) {
return -1;
}
fstrcpy(gid_str, gidtoname(session->gid));
}
}