File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -66,11 +66,22 @@ void HTTPMultipartBodyParser::fillBuffer(size_t maxLen) {
6666 if (peekBuffer == NULL ) {
6767 // Nothing in the buffer. Allocate one of the wanted size
6868 peekBuffer = (char *)malloc (maxLen);
69+ if (peekBuffer == NULL ) {
70+ HTTPS_LOGE (" Multipart: out of memory" );
71+ discardBody ();
72+ return ;
73+ }
6974 bufPtr = peekBuffer;
7075 peekBufferSize = 0 ;
7176 } else if (peekBufferSize < maxLen) {
7277 // Something in the buffer, but not enough
73- peekBuffer = (char *)realloc (peekBuffer, maxLen);
78+ char *newPeekBuffer = (char *)realloc (peekBuffer, maxLen);
79+ if (newPeekBuffer == NULL ) {
80+ HTTPS_LOGE (" Multipart: out of memory" );
81+ discardBody ();
82+ return ;
83+ }
84+ peekBuffer = newPeekBuffer;
7485 bufPtr = peekBuffer + peekBufferSize;
7586 } else {
7687 // We already have enough data in the buffer.
You can’t perform that action at this time.
0 commit comments