| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent bf49c77 commit 9a26346
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -66,11 +66,22 @@ void HTTPMultipartBodyParser::fillBuffer(size_t maxLen) { | |||
| 66 | 66 | if (peekBuffer == NULL) { | |
| 67 | 67 | // Nothing in the buffer. Allocate one of the wanted size | |
| 68 | 68 | peekBuffer = (char *)malloc(maxLen); | |
| 69 | + if (peekBuffer == NULL) { | ||
| 70 | + HTTPS_LOGE("Multipart: out of memory"); | ||
| 71 | + discardBody(); | ||
| 72 | + return; | ||
| 73 | + } | ||
| 69 | 74 | bufPtr = peekBuffer; | |
| 70 | 75 | peekBufferSize = 0; | |
| 71 | 76 | } else if (peekBufferSize < maxLen) { | |
| 72 | 77 | // 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; | ||
| 74 | 85 | bufPtr = peekBuffer + peekBufferSize; | |
| 75 | 86 | } else { | |
| 76 | 87 | // We already have enough data in the buffer. | |
| Back | FazBrowse Home | New Git URL |
0 commit comments