Skip to content

Commit 2a07dc9

Browse files
Egor Shestakovwtarreau
authored andcommitted
BUG/MINOR: startup: handle a possible strdup() failure
Fix unhandled strdup() failure when initializing global.log_tag. Bug was introduced with the fix UAF for global progname pointer from 351ae5d. So it must be backported as far as 3.1.
1 parent 9dd7cf7 commit 2a07dc9

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/haproxy.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,6 +1441,10 @@ static void init_early(int argc, char **argv)
14411441
}
14421442

14431443
chunk_initlen(&global.log_tag, strdup(progname), len, len);
1444+
if (b_orig(&global.log_tag) == NULL) {
1445+
ha_alert("Cannot allocate memory for log_tag.\n");
1446+
exit(EXIT_FAILURE);
1447+
}
14441448
}
14451449

14461450
/* handles program arguments. Very minimal parsing is performed, variables are

0 commit comments

Comments
 (0)