diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2018-07-02 12:38:33 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2018-07-02 12:38:33 +0000 |
commit | 3cb4106b13aa883f3b704aa4026b78fd36db3756 (patch) | |
tree | 7909fa214055aa344a71b515c8781c03db32ab79 /src/libnsss/nsss_switch_grp_read.c | |
parent | 42c3adc8841167026bb8409cb5e4390a32bff49a (diff) | |
download | nsss-3cb4106b13aa883f3b704aa4026b78fd36db3756.tar.gz nsss-3cb4106b13aa883f3b704aa4026b78fd36db3756.tar.xz nsss-3cb4106b13aa883f3b704aa4026b78fd36db3756.zip |
Add test framework, fix some bugs
Diffstat (limited to 'src/libnsss/nsss_switch_grp_read.c')
-rw-r--r-- | src/libnsss/nsss_switch_grp_read.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libnsss/nsss_switch_grp_read.c b/src/libnsss/nsss_switch_grp_read.c index 6152484..74b981b 100644 --- a/src/libnsss/nsss_switch_grp_read.c +++ b/src/libnsss/nsss_switch_grp_read.c @@ -1,5 +1,6 @@ /* ISC license. */ + #include <stdint.h> #include <string.h> #include <errno.h> @@ -33,7 +34,7 @@ int nsss_switch_grp_read (buffer *b, struct group *gr, stralloc *sa, genalloc *g uint32_unpack_big(buf, &x) ; grtmp.gr_gid = x ; uint32_unpack_big(buf + 4, &total) ; uint32_unpack_big(buf + 8, &n) ; - if (n >= 0x30000000u) return (errno = EPROTO, 0) ; + if (total < 2 || n >= 0x30000000u) return (errno = EPROTO, 0) ; if (!stralloc_readyplus(sa, total)) return 0 ; if (!genalloc_readyplus(char *, ga, n+1)) return 0 ; if (!buffer_timed_get(b, sa->s + sa->len, total, deadline, stamp)) return 0 ; |