mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-02 12:14:38 +02:00
wolfcrypt/src/asn.c: in C89 codepath of GetFormattedTime(), add buffer size checks before calls to sprintf().
This commit is contained in:
@@ -12389,6 +12389,10 @@ int GetFormattedTime(void* currTime, byte* buf, word32 len)
|
|||||||
mini = ts->tm_min;
|
mini = ts->tm_min;
|
||||||
sec = ts->tm_sec;
|
sec = ts->tm_sec;
|
||||||
#if defined(WOLF_C89)
|
#if defined(WOLF_C89)
|
||||||
|
if (len < 14) {
|
||||||
|
WOLFSSL_MSG("buffer for GetFormattedTime is too short.");
|
||||||
|
return BUFFER_E;
|
||||||
|
}
|
||||||
ret = XSPRINTF((char*)buf,
|
ret = XSPRINTF((char*)buf,
|
||||||
#else
|
#else
|
||||||
ret = XSNPRINTF((char*)buf, len,
|
ret = XSNPRINTF((char*)buf, len,
|
||||||
@@ -12405,6 +12409,10 @@ int GetFormattedTime(void* currTime, byte* buf, word32 len)
|
|||||||
mini = ts->tm_min;
|
mini = ts->tm_min;
|
||||||
sec = ts->tm_sec;
|
sec = ts->tm_sec;
|
||||||
#if defined(WOLF_C89)
|
#if defined(WOLF_C89)
|
||||||
|
if (len < 16) {
|
||||||
|
WOLFSSL_MSG("buffer for GetFormattedTime is too short.");
|
||||||
|
return BUFFER_E;
|
||||||
|
}
|
||||||
ret = XSPRINTF((char*)buf,
|
ret = XSPRINTF((char*)buf,
|
||||||
#else
|
#else
|
||||||
ret = XSNPRINTF((char*)buf, len,
|
ret = XSNPRINTF((char*)buf, len,
|
||||||
|
Reference in New Issue
Block a user