]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: cfgparse: incorrect memmove in quotes management
authorWilliam Lallemand <wlallemand@haproxy.com>
Tue, 12 May 2015 12:01:09 +0000 (14:01 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 12 May 2015 13:27:45 +0000 (15:27 +0200)
The size of the memmove was incorrect (one byte too far) in the quotes
parser and can lead to segfault during configuration parsing.

src/cfgparse.c

index 39ba14515c7f27e2f8a88ff1bcb59e2ab4b3e2a2..8469dfd24862c8d6cfbc63b4058f1637f2f067c8 100644 (file)
@@ -6331,7 +6331,7 @@ int readcfgfile(const char *file)
                                        dquote = 0;
                                else
                                        dquote = 1;
-                               memmove(line, line + 1, end - (line + 1));
+                               memmove(line, line + 1, end - line);
                                end--;
                        }
                        else if (*line == '\'' && !dquote) { /* single quote outside double quotes */
@@ -6339,7 +6339,7 @@ int readcfgfile(const char *file)
                                        squote = 0;
                                else
                                        squote = 1;
-                               memmove(line, line + 1, end - (line + 1));
+                               memmove(line, line + 1, end - line);
                                end--;
                        }
                        else if (*line == '\\' && !squote) {