diff options
| author | Laurent Bercot <ska-skaware@skarnet.org> | 2026-06-21 21:07:50 +0000 |
|---|---|---|
| committer | Laurent Bercot <ska-skaware@skarnet.org> | 2026-06-21 21:07:50 +0000 |
| commit | 9ec7fa5fdae099ff8a11e24cf40ee603403991e1 (patch) | |
| tree | 51a2b26361742a3edc30310e600cc00de0e172c2 /src/libnsss/nsss_switch_shadow_read.c | |
| parent | 0266369bb890f16bfd19c4036bc69aa261c0623e (diff) | |
| download | nsss-9ec7fa5fdae099ff8a11e24cf40ee603403991e1.tar.gz | |
Fix hardening of string reading from nsssd-switch
Diffstat (limited to 'src/libnsss/nsss_switch_shadow_read.c')
| -rw-r--r-- | src/libnsss/nsss_switch_shadow_read.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libnsss/nsss_switch_shadow_read.c b/src/libnsss/nsss_switch_shadow_read.c index 7d4c2a4..2bb4b7a 100644 --- a/src/libnsss/nsss_switch_shadow_read.c +++ b/src/libnsss/nsss_switch_shadow_read.c @@ -47,9 +47,9 @@ int nsss_switch_shadow_read (buffer *b, struct spwd *sp, stralloc *sa, tain cons if (!buffer_timed_get(b, sa->s + sa->len, total, deadline, stamp)) return 0 ; if (sa->s[sa->len + total - 1]) return (errno = EPROTO, 0) ; p = sa->s + sa->len ; len = total ; - sptmp.sp_namp = p ; x = strnlen(p, len) + 1 ; p += x ; len -= x ; + sptmp.sp_namp = p ; x = strnlen(p, len-1) + 1 ; p += x ; len -= x ; if (!len) return (errno = EPROTO, 0) ; - sptmp.sp_pwdp = p ; x = strnlen(p, len) + 1 ; p += x ; len -= x ; + sptmp.sp_pwdp = p ; x = strnlen(p, len-1) + 1 ; p += x ; len -= x ; if (len) return (errno = EPROTO, 0) ; sa->len += total ; *sp = sptmp ; |
