From: Marco Bettini Date: Fri, 3 Feb 2023 16:25:19 +0000 (+0000) Subject: lib-storage: set_line() - Add check against empty lines and keys, drop suffixing... X-Git-Tag: 2.4.0~3001 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eedac4a5e937d49ee0d4c7d2b1af8f980408b3d2;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: set_line() - Add check against empty lines and keys, drop suffixing lines without '=' The previous check is no longer necessary as keys are now always followed by '=', but in case of empty lines now the function would crash instead of setting "plugin/=yes" (which didn't make sense either) --- diff --git a/src/lib-storage/mail-storage-service.c b/src/lib-storage/mail-storage-service.c index cccb420f54..6fb3d05a35 100644 --- a/src/lib-storage/mail-storage-service.c +++ b/src/lib-storage/mail-storage-service.c @@ -142,10 +142,13 @@ static int set_line(struct mail_storage_service_ctx *ctx, size_t len; int ret; - if (strchr(line, '=') == NULL) - line = t_strconcat(line, "=yes", NULL); orig_key = key = t_strcut(line, '='); + /* Ignore empty keys (and lines) rather than prepend 'plugin/=' to them. + Also, prevent emtpy lines from crashing later in settings_parse_line() */ + if (*key == '\0') + return 1; + len = strlen(key); if (len > 0 && key[len-1] == '+') { /* key+=value */