From: <chenjie6@huawei.com>
To: <rtweed@thoughtmachine.net>
Cc: <musl@lists.openwall.com>, chen jie <chenjie6@huawei.com>
Subject: [PATCH] musl: bugfix getspnam_r negative
Date: Thu, 16 May 2019 02:31:04 +0000 [thread overview]
Message-ID: <1557973864-126747-1-git-send-email-chenjie6@huawei.com> (raw)
From: chen jie <chenjie6@huawei.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@huawei.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
next reply other threads:[~2019-05-16 2:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-16 2:31 chenjie6 [this message]
2019-05-16 8:03 ` Szabolcs Nagy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1557973864-126747-1-git-send-email-chenjie6@huawei.com \
--to=chenjie6@huawei.com \
--cc=musl@lists.openwall.com \
--cc=rtweed@thoughtmachine.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).