FreeBSD Bugzilla – Attachment 196301 Details for
Bug 230720
strptime() conversion and validation issues
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Patch file for strptime.c
patch.txt (text/plain), 1.62 KB, created by
rlittle@inetco.com
on 2018-08-17 22:19:07 UTC
(
hide
)
Description:
Patch file for strptime.c
Filename:
MIME Type:
Creator:
rlittle@inetco.com
Created:
2018-08-17 22:19:07 UTC
Size:
1.62 KB
patch
obsolete
>--- strptime_orig.c 2018-08-16 11:52:33.000000000 -0700 >+++ strptime.c 2018-08-17 15:11:22.266963625 -0700 >@@ -89,8 +89,9 @@ > char c; > const char *ptr; > int day_offset = -1, wday_offset; >- int week_offset; >- int i, len; >+ int week_offset = 0; >+ int i; >+ size_t len; > int flags; > int Ealternative, Oalternative; > const struct lc_time_T *tptr = __get_current_time_locale(locale); >@@ -276,10 +277,20 @@ > * XXX The %l specifier may gobble one too many > * digits if used incorrectly. > */ >+ >+ /* >+ * Skip optional blank pad for %k and %l. >+ * >+ */ >+ len = 2; >+ if ((c == 'k' || c == 'l') && isblank_l((unsigned char)*buf, locale)) >+ { >+ len = 1; >+ buf++; >+ } > if (!isdigit_l((unsigned char)*buf, locale)) > return (NULL); > >- len = 2; > for (i = 0; len && *buf != 0 && > isdigit_l((unsigned char)*buf, locale); buf++) { > i *= 10; >@@ -289,7 +300,7 @@ > if (c == 'H' || c == 'k') { > if (i > 23) > return (NULL); >- } else if (i > 12) >+ } else if ((i > 12) || (i == 0)) > return (NULL); > > tm->tm_hour = i; >@@ -324,6 +335,7 @@ > > case 'A': > case 'a': >+ len = 0; > for (i = 0; i < asizeof(tptr->weekday); i++) { > len = strlen(tptr->weekday[i]); > if (strncasecmp_l(buf, tptr->weekday[i], >@@ -417,7 +429,7 @@ > i += *buf - '0'; > len--; > } >- if (i > 31) >+ if ((i > 31) || (i == 0)) > return (NULL); > > tm->tm_mday = i; >@@ -428,6 +440,7 @@ > case 'B': > case 'b': > case 'h': >+ len = 0; > for (i = 0; i < asizeof(tptr->month); i++) { > if (Oalternative) { > if (c == 'B') {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 230720
: 196301