Commit bcb1aee8 authored by Jeff Smith's avatar Jeff Smith Committed by Alexandre Julliard

msvcrt: Correct hour range for strftime.

parent cdb09ed2
...@@ -1344,12 +1344,10 @@ static MSVCRT_size_t strftime_impl(STRFTIME_CHAR *str, MSVCRT_size_t max, ...@@ -1344,12 +1344,10 @@ static MSVCRT_size_t strftime_impl(STRFTIME_CHAR *str, MSVCRT_size_t max,
return 0; return 0;
break; break;
case 'I': case 'I':
tmp = mstm->tm_hour; if(!MSVCRT_CHECK_PMT(mstm->tm_hour>=0 && mstm->tm_hour<=23))
if(tmp > 12) goto einval_error;
tmp -= 12; if(!strftime_int(str, &ret, max, (mstm->tm_hour + 11) % 12 + 1,
else if(!tmp) alternate ? 0 : 2, 1, 12))
tmp = 12;
if(!strftime_int(str, &ret, max, tmp, alternate ? 0 : 2, 1, 12))
return 0; return 0;
break; break;
case 'j': case 'j':
......
...@@ -965,14 +965,14 @@ static void test_strftime(void) ...@@ -965,14 +965,14 @@ static void test_strftime(void)
{"%u", "6", { 0, 0, 0, 1, 0, 117, 6, 0, 0 }}, {"%u", "6", { 0, 0, 0, 1, 0, 117, 6, 0, 0 }},
{"%u", "", { 0, 0, 0, 1, 0, 117, 7, 0, 0 }, TRUE}, {"%u", "", { 0, 0, 0, 1, 0, 117, 7, 0, 0 }, TRUE},
{"%h", "Jan", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }}, {"%h", "Jan", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }},
{"%I", "", { 0, 0, -1, 1, 0, 70, 4, 0, 0 }, FALSE, TRUE}, {"%I", "", { 0, 0, -1, 1, 0, 70, 4, 0, 0 }},
{"%I", "12", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }}, {"%I", "12", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }},
{"%I", "01", { 0, 0, 1, 1, 0, 70, 4, 0, 0 }}, {"%I", "01", { 0, 0, 1, 1, 0, 70, 4, 0, 0 }},
{"%I", "11", { 0, 0, 11, 1, 0, 70, 4, 0, 0 }}, {"%I", "11", { 0, 0, 11, 1, 0, 70, 4, 0, 0 }},
{"%I", "12", { 0, 0, 12, 1, 0, 70, 4, 0, 0 }}, {"%I", "12", { 0, 0, 12, 1, 0, 70, 4, 0, 0 }},
{"%I", "01", { 0, 0, 13, 1, 0, 70, 4, 0, 0 }}, {"%I", "01", { 0, 0, 13, 1, 0, 70, 4, 0, 0 }},
{"%I", "11", { 0, 0, 23, 1, 0, 70, 4, 0, 0 }}, {"%I", "11", { 0, 0, 23, 1, 0, 70, 4, 0, 0 }},
{"%I", "", { 0, 0, 24, 1, 0, 70, 4, 0, 0 }, TRUE}, {"%I", "", { 0, 0, 24, 1, 0, 70, 4, 0, 0 }},
{"%n", "\n", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }}, {"%n", "\n", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }},
{"%r", "12:00:00 AM", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }, TRUE}, {"%r", "12:00:00 AM", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }, TRUE},
{"%r", "02:00:00 PM", { 0, 0, 14, 1, 0, 121, 6, 0, 0 }, TRUE}, {"%r", "02:00:00 PM", { 0, 0, 14, 1, 0, 121, 6, 0, 0 }, TRUE},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment