提交 f539cfbe 编写于 作者: J Junio C Hamano

Merge branch 'maint'

* maint:
  fast-import.c::validate_raw_date(): really validate the value
......@@ -1744,10 +1744,12 @@ static int validate_raw_date(const char *src, char *result, int maxlen)
{
const char *orig_src = src;
char *endp;
unsigned long num;
errno = 0;
strtoul(src, &endp, 10);
num = strtoul(src, &endp, 10);
/* NEEDSWORK: perhaps check for reasonable values? */
if (errno || endp == src || *endp != ' ')
return -1;
......@@ -1755,8 +1757,9 @@ static int validate_raw_date(const char *src, char *result, int maxlen)
if (*src != '-' && *src != '+')
return -1;
strtoul(src + 1, &endp, 10);
if (errno || endp == src || *endp || (endp - orig_src) >= maxlen)
num = strtoul(src + 1, &endp, 10);
if (errno || endp == src + 1 || *endp || (endp - orig_src) >= maxlen ||
1400 < num)
return -1;
strcpy(result, orig_src);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册