From c3b7e650c5efb8262bc0998babaf9947ad29797a Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Thu, 5 Nov 2015 14:47:45 +0000 Subject: 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. --- utils/nsoption.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'utils/nsoption.c') 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 . */ -/** \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; -- cgit v1.2.3