8304836: Make MALLOC_MIN4 macro more robust
Reviewed-by: bchristi
This commit is contained in:
parent
2763cf14e6
commit
f32adaf89f
@ -39,7 +39,7 @@
|
||||
* negative, or the size is INT_MAX as the macro adds 1
|
||||
* that overflows into negative value.
|
||||
*/
|
||||
#define MALLOC_MIN4(len) ((unsigned)(len) >= INT_MAX ? \
|
||||
#define MALLOC_MIN4(len) ((len) >= INT_MAX || (len) < 0 ? \
|
||||
NULL : \
|
||||
((char *)malloc((len) + 1 < 4 ? 4 : (len) + 1)))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user