aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2016-03-12 17:52:00 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2016-03-12 17:56:25 +0200
commit6007d801392d50e908b810c9658ad8bcd1f7d631 (patch)
tree8b590bf190f5cc0723b8393c32c1647e5f24f643
parentc90ba2a863a446b51b9ee960cead69a4b2884045 (diff)
downloadvmod-variable-6007d801392d50e908b810c9658ad8bcd1f7d631.tar.gz
vmod-variable-6007d801392d50e908b810c9658ad8bcd1f7d631.tar.bz2
Fix NULL dereferencing.4.0
The bug was triggered by invoking symtab_remove with the name that has not yet been entered into the symtab. Reported by Julian Sternberg. * src/variable.c (symtab_remove): Return ENOENT if no matching entry was found.
-rw-r--r--src/variable.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/variable.c b/src/variable.c
index e6bad1a..6b23c00 100644
--- a/src/variable.c
+++ b/src/variable.c
@@ -1,5 +1,5 @@
1/* This file is part of vmod-tbf 1/* This file is part of vmod-variable
2 Copyright (C) 2013-2015 Sergey Poznyakoff 2 Copyright (C) 2013-2016 Sergey Poznyakoff
3 3
4 Vmod-tbf is free software; you can redistribute it and/or modify 4 Vmod-variable is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
@@ -8,3 +8,3 @@
8 8
9 Vmod-tbf is distributed in the hope that it will be useful, 9 Vmod-variable is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -14,3 +14,3 @@
14 You should have received a copy of the GNU General Public License 14 You should have received a copy of the GNU General Public License
15 along with vmod-tbf. If not, see <http://www.gnu.org/licenses/>. 15 along with vmod-variable. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
@@ -184,2 +184,5 @@ symtab_remove(struct symtab *st, const char *name)
184 184
185 if (!entry)
186 return ENOENT;
187
185 var_free(entry); 188 var_free(entry);
@@ -394,2 +397,3 @@ get_symtab(VARIABLE_CTX ctx)
394 symtabv = realloc(symtabv, n * sizeof(symtabv[0])); 397 symtabv = realloc(symtabv, n * sizeof(symtabv[0]));
398 AN(symtabv);
395 while (symtabc < n) 399 while (symtabc < n)

Return to:

Send suggestions and report system problems to the System administrator.