* [PATCH OB] debuginfod-client: Fix out-of-bounds write
@ 2022-11-01 23:55 Aaron Merey
0 siblings, 0 replies; only message in thread
From: Aaron Merey @ 2022-11-01 23:55 UTC (permalink / raw)
To: elfutils-devel; +Cc: Aaron Merey
Pushed as obvious.
Return early from path_escape when '\0' is seen in order to prevent
an out-of-bounds write to the dest buffer.
Signed-off-by: Aaron Merey <amerey@redhat.com>
---
debuginfod/debuginfod-client.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c
index d097ca49..0c4a00cf 100644
--- a/debuginfod/debuginfod-client.c
+++ b/debuginfod/debuginfod-client.c
@@ -595,8 +595,7 @@ path_escape (const char *src, char *dest)
{
case '\0':
dest[q] = '\0';
- q = PATH_MAX-1; /* escape for loop too */
- break;
+ return;
case '/': /* escape / to prevent dir escape */
dest[q++]='#';
dest[q++]='#';
--
2.37.3
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-11-01 23:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-01 23:55 [PATCH OB] debuginfod-client: Fix out-of-bounds write Aaron Merey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).