aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2021-07-30 22:20:05 +0200
committerFlorian Dold <florian@dold.me>2021-07-30 22:20:05 +0200
commitdccf60f8919c0ba5d97b9c8ffa774987bf46c5fe (patch)
treee63848def5ad120375d8f315706b830562b65d2f /src/util
parentfd277f253027f03f3a7b0dc8acc935e799d645f5 (diff)
downloadgnunet-dccf60f8919c0ba5d97b9c8ffa774987bf46c5fe.tar.gz
gnunet-dccf60f8919c0ba5d97b9c8ffa774987bf46c5fe.zip
config: handle syntax error instead of dereferencing NULL pointer
Diffstat (limited to 'src/util')
-rw-r--r--src/util/configuration.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/util/configuration.c b/src/util/configuration.c
index e515c7c46..8553d2b61 100644
--- a/src/util/configuration.c
+++ b/src/util/configuration.c
@@ -616,7 +616,7 @@ handle_inline (struct GNUNET_CONFIGURATION_Handle *cfg,
616 { 616 {
617 fun_ret = GNUNET_OK; 617 fun_ret = GNUNET_OK;
618 } 618 }
619cleanup: 619 cleanup:
620 cfg->current_nest_level = old_nest_level; 620 cfg->current_nest_level = old_nest_level;
621 if (NULL != other_cfg) 621 if (NULL != other_cfg)
622 GNUNET_CONFIGURATION_destroy (other_cfg); 622 GNUNET_CONFIGURATION_destroy (other_cfg);
@@ -890,6 +890,16 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg,
890 { 890 {
891 size_t i; 891 size_t i;
892 892
893 if (NULL == section)
894 {
895 LOG (GNUNET_ERROR_TYPE_WARNING,
896 _ (
897 "Syntax error while deserializing in line %u (option without section)\n"),
898 nr);
899 ret = GNUNET_SYSERR;
900 break;
901 }
902
893 /* tag = value */ 903 /* tag = value */
894 tag = GNUNET_strndup (line, eq - line); 904 tag = GNUNET_strndup (line, eq - line);
895 /* remove tailing whitespace */ 905 /* remove tailing whitespace */
@@ -2300,7 +2310,7 @@ GNUNET_CONFIGURATION_load_from (struct GNUNET_CONFIGURATION_Handle *cfg,
2300 if (fun_ret != GNUNET_OK) 2310 if (fun_ret != GNUNET_OK)
2301 break; 2311 break;
2302 } 2312 }
2303cleanup: 2313 cleanup:
2304 if (files_context.files_length > 0) 2314 if (files_context.files_length > 0)
2305 { 2315 {
2306 for (size_t i = 0; i < files_context.files_length; i++) 2316 for (size_t i = 0; i < files_context.files_length; i++)