mirror of
https://github.com/facebook/zstd
synced 2026-08-22 22:32:07 -04:00
Merge e346d88468 into 82d322c497
This commit is contained in:
commit
92c42670a1
1 changed files with 3 additions and 0 deletions
|
|
@ -13,6 +13,7 @@
|
|||
******************************************/
|
||||
#include "util.h" /* note : ensure that platform.h is included first ! */
|
||||
#include <stdlib.h> /* malloc, realloc, free */
|
||||
#include <stdint.h> /* SIZE_MAX */
|
||||
#include <stdio.h> /* fprintf */
|
||||
#include <time.h> /* clock_t, clock, CLOCKS_PER_SEC, nanosleep */
|
||||
#include <errno.h>
|
||||
|
|
@ -1212,6 +1213,8 @@ static char* mallocAndJoin2Dir(const char *dir1, const char *dir2)
|
|||
const size_t dir2Size = strlen(dir2);
|
||||
char *outDirBuffer, *buffer;
|
||||
|
||||
/* reject sizes that would overflow the malloc() argument */
|
||||
CONTROL(dir1Size <= SIZE_MAX - dir2Size - 2);
|
||||
outDirBuffer = (char *) malloc(dir1Size + dir2Size + 2);
|
||||
CONTROL(outDirBuffer != NULL);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue