(strftime): check for return values from snprintf() < 0
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@10654 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999 - 2000 Kungliga Tekniska H<>gskolan
|
||||
* Copyright (c) 1999 - 2001 Kungliga Tekniska H<>gskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
@@ -172,7 +172,7 @@ strftime (char *buf, size_t maxsize, const char *format,
|
||||
const struct tm *tm)
|
||||
{
|
||||
size_t n = 0;
|
||||
size_t ret;
|
||||
int ret;
|
||||
|
||||
while (*format != '\0' && n < maxsize) {
|
||||
if (*format == '%') {
|
||||
@@ -381,7 +381,7 @@ strftime (char *buf, size_t maxsize, const char *format,
|
||||
"%%%c", *format);
|
||||
break;
|
||||
}
|
||||
if (ret >= maxsize - n)
|
||||
if (ret < 0 || ret >= maxsize - n)
|
||||
return 0;
|
||||
n += ret;
|
||||
buf += ret;
|
||||
|
Reference in New Issue
Block a user