diff options
author | René Scharfe <l.s.r@web.de> | 2024-04-05 12:53:23 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-04-05 09:49:36 -0700 |
commit | 9126cb3186112f160a601e9a7eda29dd43227576 (patch) | |
tree | d85adfc3cc92e4b525eb459b9f482b7a88b410dd /builtin/commit.c | |
parent | 3c2a3fdc388747b9eaf4a4a4f2035c1c9ddb26d0 (diff) |
apply: avoid fixed-size buffer in create_one_file()
PATH_MAX is not always a hard limit and 'path' in create_one_file()
could be longer -- it's taken from the patch file and allocated
dynamically. Allocate the name of the temporary file on the heap as
well instead of using a fixed-size buffer to avoid that arbitrary limit.
Resist the temptation of using the more convenient mkpath() to avoid
introducing a dependency on a static variable deep inside the apply
machinery.
Take care to work around (arguably buggy) implementations of free(3)
that modify errno, by calling it only after using the errno value.
Suggested-by: Jeff King <peff@peff.net>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/commit.c')
0 files changed, 0 insertions, 0 deletions