mirror of
https://github.com/tmux/tmux.git
synced 2026-04-16 03:56:28 +00:00
Do not leak trimmed string when expanding, found by ossfuzz.
This commit is contained in:
@@ -1116,7 +1116,7 @@ format_width(const char *expanded)
|
|||||||
/*
|
/*
|
||||||
* Trim on the left, taking #[] into account. Note, we copy the whole set of
|
* Trim on the left, taking #[] into account. Note, we copy the whole set of
|
||||||
* unescaped #s, but only add their escaped size to width. This is because the
|
* unescaped #s, but only add their escaped size to width. This is because the
|
||||||
* format_draw function will actually do the escaping when it runs
|
* format_draw function will actually do the escaping.
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
format_trim_left(const char *expanded, u_int limit)
|
format_trim_left(const char *expanded, u_int limit)
|
||||||
|
|||||||
2
format.c
2
format.c
@@ -5325,6 +5325,7 @@ done:
|
|||||||
if (marker != NULL && strcmp(new, value) != 0) {
|
if (marker != NULL && strcmp(new, value) != 0) {
|
||||||
free(value);
|
free(value);
|
||||||
xasprintf(&value, "%s%s", new, marker);
|
xasprintf(&value, "%s%s", new, marker);
|
||||||
|
free(new);
|
||||||
} else {
|
} else {
|
||||||
free(value);
|
free(value);
|
||||||
value = new;
|
value = new;
|
||||||
@@ -5335,6 +5336,7 @@ done:
|
|||||||
if (marker != NULL && strcmp(new, value) != 0) {
|
if (marker != NULL && strcmp(new, value) != 0) {
|
||||||
free(value);
|
free(value);
|
||||||
xasprintf(&value, "%s%s", marker, new);
|
xasprintf(&value, "%s%s", marker, new);
|
||||||
|
free(new);
|
||||||
} else {
|
} else {
|
||||||
free(value);
|
free(value);
|
||||||
value = new;
|
value = new;
|
||||||
|
|||||||
Reference in New Issue
Block a user