Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7be497e

Browse filesBrowse files
committed
Handle buffer underflow as an internal error.
1 parent bd837a0 commit 7be497e
Copy full SHA for 7be497e

File tree

Expand file treeCollapse file tree

1 file changed

+5
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-1
lines changed

‎src/_path.h

Copy file name to clipboardExpand all lines: src/_path.h
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -959,7 +959,11 @@ char *__append_to_string(char *p, char **buffer, size_t *buffersize,
959959
int buffersize_int = (int)*buffersize;
960960

961961
for (const char *i = content; *i; ++i) {
962-
if (p < *buffer || p - *buffer >= buffersize_int) {
962+
if (p < *buffer) {
963+
/* This is just an internal error */
964+
return NULL;
965+
}
966+
if (p - *buffer >= buffersize_int) {
963967
int diff = p - *buffer;
964968
*buffersize *= 2;
965969
*buffer = (char *)realloc(*buffer, *buffersize);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.