diff options
author | Vincent Sanders <vince@kyllikki.org> | 2015-11-05 14:47:45 +0000 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2015-11-05 14:47:45 +0000 |
commit | c3b7e650c5efb8262bc0998babaf9947ad29797a (patch) | |
tree | 63c345a0ec395ba306339449ab37a89a7f2a42a5 | |
parent | b54174e54a7f55cb6e11b6fb20f6615b37f5b65a (diff) | |
download | netsurf-c3b7e650c5efb8262bc0998babaf9947ad29797a.tar.gz netsurf-c3b7e650c5efb8262bc0998babaf9947ad29797a.tar.bz2 |
Fix segmentation fault when a string option is set to NULL
The check for a user option being a default value was not protecting
against the value being set to NULL.
-rw-r--r-- | utils/nsoption.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/utils/nsoption.c b/utils/nsoption.c index 416e18dd7..1309ed875 100644 --- a/utils/nsoption.c +++ b/utils/nsoption.c @@ -16,7 +16,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -/** \file +/** + * \file * Option reading and saving (implementation). * * Options are stored in the format key:value, one per line. @@ -232,6 +233,8 @@ nsoption_is_set(const struct nsoption_s *opts, */ if (((defs[entry].value.s == NULL) && (opts[entry].value.s != NULL)) || + ((defs[entry].value.s != NULL) && + (opts[entry].value.s == NULL)) || ((defs[entry].value.s != opts[entry].value.s) && (strcmp(opts[entry].value.s, defs[entry].value.s) != 0))) { ret = true; |