Add os_snprintf_error() helper
This can be used to check os_snprintf() return value more consistently. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
89b48f7b95
commit
0047306bc9
1 changed files with 6 additions and 0 deletions
|
@ -549,6 +549,12 @@ char * os_strdup(const char *s);
|
||||||
#endif /* OS_NO_C_LIB_DEFINES */
|
#endif /* OS_NO_C_LIB_DEFINES */
|
||||||
|
|
||||||
|
|
||||||
|
static inline int os_snprintf_error(size_t size, int res)
|
||||||
|
{
|
||||||
|
return res < 0 || (unsigned int) res >= size;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline void * os_realloc_array(void *ptr, size_t nmemb, size_t size)
|
static inline void * os_realloc_array(void *ptr, size_t nmemb, size_t size)
|
||||||
{
|
{
|
||||||
if (size && nmemb > (~(size_t) 0) / size)
|
if (size && nmemb > (~(size_t) 0) / size)
|
||||||
|
|
Loading…
Reference in a new issue