[ipxe-devel] [PATCH ipxe v2 1/4] [settings] do not store unparsable setting
David Decotigny
ddecotig at gmail.com
Tue Dec 6 01:02:01 UTC 2016
---
src/core/settings.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/core/settings.c b/src/core/settings.c
index c306054..b4ccedf 100644
--- a/src/core/settings.c
+++ b/src/core/settings.c
@@ -1344,12 +1344,19 @@ int storef_setting ( struct settings *settings, const struct setting *setting,
/* Parse formatted value */
check_len = setting_parse ( setting->type, value, raw, raw_len );
- assert ( check_len == raw_len );
+ if ( check_len != raw_len ) {
+ if (check_len < 0)
+ rc = check_len;
+ else
+ rc = -EINVAL;
+ goto err_einval;
+ }
/* Store raw value */
if ( ( rc = store_setting ( settings, setting, raw, raw_len ) ) != 0 )
goto err_store;
+ err_einval:
err_store:
free ( raw );
err_alloc_raw:
--
2.8.0.rc3.226.g39d4020
More information about the ipxe-devel
mailing list