mirror of
https://git.musl-libc.org/git/musl
synced 2025-02-16 02:04:10 +03:00
fix gratuitous undefined behavior in strptime
accessing an object of type const char *restrict as if it had type char * is not defined.
This commit is contained in:
parent
b24f1d2520
commit
f33b175850
@ -22,8 +22,13 @@ char *strptime(const char *restrict s, const char *restrict f, struct tm *restri
|
||||
}
|
||||
f++;
|
||||
if (*f == '+') f++;
|
||||
if (isdigit(*f)) w=strtoul(f, (void *)&f, 10);
|
||||
else w=-1;
|
||||
if (isdigit(*f)) {
|
||||
char *new_f;
|
||||
w=strtoul(f, &new_f, 10);
|
||||
f = new_f;
|
||||
} else {
|
||||
w=-1;
|
||||
}
|
||||
adj=0;
|
||||
switch (*f++) {
|
||||
case 'a': case 'A':
|
||||
|
Loading…
x
Reference in New Issue
Block a user