Thread (5 messages) flat view 5 messages, 2 authors, 2016-06-15

Re: [PATCH] Fix buffer overflow in config parser

From: Markus Heidelberg <hidden>
Date: 2016-06-15 22:46:35

Markus Heidelberg, 09.04.2009:
Thomas Jarosch, 09.04.2009:
quoted
Hello together,

attached is a small patch to fix a buffer overflow in config.c.
Patch is against git master's HEAD.

I didn't send this one inline as I wanted to
preserve the 1024+ byte long line.
You could send the patch inline and attach the example config.
quoted
diff --git a/config.c b/config.c
index b76fe4c..a9c67e8 100644
--- a/config.c
+++ b/config.c
@@ -72,7 +72,7 @@ static char *parse_value(void)
                        }
                }
                if (space) {
-                       if (len)
+                       if (len && len < sizeof(value)-1)
                                value[len++] = ' ';
                        space = 0;
Eh, or maybe better add a "continue;" here, so that only one char per
loop is read.
quoted
                }
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help