|
Message-ID: <1557973864-126747-1-git-send-email-chenjie6@huawei.com> Date: Thu, 16 May 2019 02:31:04 +0000 From: <chenjie6@...wei.com> To: <rtweed@...ughtmachine.net> CC: <musl@...ts.openwall.com>, chen jie <chenjie6@...wei.com> Subject: [PATCH] musl: bugfix getspnam_r negative From: chen jie <chenjie6@...wei.com> The /etc/shadow contain: sshd:*:11880:0:90:7:-1:-1:0 the *s can not ++; __parsespent will not keep going down Signed-off-by: jie chen<chenjie6@...wei.com> --- src/passwd/getspnam_r.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/passwd/getspnam_r.c b/src/passwd/getspnam_r.c index 541e8531..1cb55bcd 100644 --- a/src/passwd/getspnam_r.c +++ b/src/passwd/getspnam_r.c @@ -15,8 +15,16 @@ static long xatol(char **s) { long x; + int sign; + if (**s == ':' || **s == '\n') return -1; + + sign = (int)(unsigned char)**s; + if (sign == '-' || sign == '+') ++*s; + for (x=0; **s-'0'<10U; ++*s) x=10*x+(**s-'0'); + + if (sign == '-') return -x; return x; } -- 2.18.GIT
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.