]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: test-unicode-break - Fix potential crash on empty lines
authorStephan Bosch <stephan.bosch@open-xchange.com>
Fri, 19 Dec 2025 03:02:14 +0000 (04:02 +0100)
committerStephan Bosch <stephan.bosch@open-xchange.com>
Fri, 19 Dec 2025 03:04:29 +0000 (04:04 +0100)
src/lib/test-unicode-break.c

index cd0428d4de41788691f8f4f8c7343452eef50d52..867d63ef7af08de0ea65ab909dab428ed0526553 100644 (file)
@@ -76,8 +76,10 @@ test_ucd_file(const char *file,
                line_num++;
 
                /* remove any trailing whitespace and comment */
+               if (*line == '\0')
+                       continue;
                char *end = strchr(line, '#');
-               if (end == NULL && *line != '\0')
+               if (end == NULL)
                        end = &line[strlen(line) - 1];
                while ((end - 1) >= line && (end[-1] == '\t' || end[-1] == ' '))
                        end--;