diff options
author | Volker Lendecke <vl@samba.org> | 2018-03-30 12:19:24 -0500 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2018-04-04 00:44:23 +0200 |
commit | 76babda4ef13111e402fcfac10d6f9c3d7bb75e9 (patch) | |
tree | 974cac07ebce753073a6d92a7933f9b43c30f947 /source3/groupdb | |
parent | 64b144dce315642dcf606be4eacefab7036bb6c7 (diff) | |
download | samba-76babda4ef13111e402fcfac10d6f9c3d7bb75e9.tar.gz |
groupdb: Fix CID 1167984 Ignoring number of bytes read
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'source3/groupdb')
-rw-r--r-- | source3/groupdb/mapping.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/source3/groupdb/mapping.c b/source3/groupdb/mapping.c index ac70fe68c48..1a8670e66b0 100644 --- a/source3/groupdb/mapping.c +++ b/source3/groupdb/mapping.c @@ -237,9 +237,13 @@ int smb_create_group(const char *unix_group, gid_t *new_gid) if (fd != 0) { fstring output; + ssize_t nread; *new_gid = 0; - if (read(fd, output, sizeof(output)) > 0) { + + nread = read(fd, output, sizeof(output)-1); + if (nread > 0) { + output[nread] = '\0'; *new_gid = (gid_t)strtoul(output, NULL, 10); } |