replaced two silly uses of {wcs,str}nlen() with {wcs,str}len() (it makes no sense if the given length limit is SIZE_MAX)

This commit is contained in:
Frank Seide 2014-11-03 11:34:24 -08:00
Родитель 6cc5ad9445
Коммит 1fd17be504
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -934,7 +934,7 @@ wstring fgetwtoken (FILE * f)
void fputstring (FILE * f, const char * str)
{
fwriteOrDie ((void *) str, sizeof (*str), strnlen (str, SIZE_MAX)+1, f); // SECURITY NOTE: string use has been reviewed
fwriteOrDie ((void *) str, sizeof (*str), strlen (str)+1, f);
}
void fputstring (FILE * f, const std::string & str)
@ -945,7 +945,7 @@ void fputstring (FILE * f, const std::string & str)
void fputstring (FILE * f, const wchar_t * str)
{
// TODO: we should redefine this to write UTF-16 (which matters on GCC which defines wchar_t as 32 bit)
fwriteOrDie((void *)str, sizeof (*str), wcsnlen(str, SIZE_MAX) + 1, f); // SECURITY NOTE: string use has been reviewed
fwriteOrDie((void *)str, sizeof (*str), wcslen(str) + 1, f);
}
void fputstring (FILE * f, const std::wstring & str)