Skip to content

Commit 6feb999

Browse files
committed
Fix potential integer overflow vulnerability when allocating memory
1 parent 29c9640 commit 6feb999

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

libsrc/attr.m4

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ new_x_NC_attr(
8888

8989
assert(!(xsz == 0 && nelems != 0));
9090

91+
if(sz > SIZE_MAX -xsz)
92+
return NULL;
93+
9194
sz += xsz;
9295

9396
attrp = (NC_attr *) malloc(sz);

0 commit comments

Comments
 (0)