diff --git a/src/core/settings.c b/src/core/settings.c index 75253186..e660ae7c 100644 --- a/src/core/settings.c +++ b/src/core/settings.c @@ -381,7 +381,8 @@ int fetch_setting_len ( struct settings *settings, struct setting *setting ) { int fetch_string_setting ( struct settings *settings, struct setting *setting, char *data, size_t len ) { memset ( data, 0, len ); - return fetch_setting ( settings, setting, data, ( len - 1 ) ); + return fetch_setting ( settings, setting, data, + ( ( len > 0 ) ? ( len - 1 ) : 0 ) ); } /**