]> diplodocus.org Git - nmh/commitdiff
content_error(): Don't strlen(invo_name) that might be NULL.
authorRalph Corderoy <ralph@inputplus.co.uk>
Fri, 8 Sep 2017 12:48:29 +0000 (13:48 +0100)
committerRalph Corderoy <ralph@inputplus.co.uk>
Fri, 8 Sep 2017 12:48:29 +0000 (13:48 +0100)
Earlier in content_error(), it checks invo_name isn't NULL before using
it.  Later, it passes it to strlen(3) without the check.  Either the
former is redundant or the latter wrong.  Rather than work out which,
delete the strlen(invo_name) because it was only used for a
variable-width indent on a second diagnostic line.  Instead, indent by a
fixed four spaces, which will look better when invo_name is stupidly
long anyway.  Bug present since pre-git.

test/mhlist/test-mhlist
test/mhstore/test-mhstore
uip/mhmisc.c

index 48a1913..42d2f43 100755 (executable)
@@ -183,7 +183,7 @@ run_test 'mhlist last -part 2 -noheader -check' \
      1     multipart/related          180
      2     text/plain                  36
 mhlist: content integrity suspect (digest mismatch) -- continuing
      1     multipart/related          180
      2     text/plain                  36
 mhlist: content integrity suspect (digest mismatch) -- continuing
-        (content text/plain in message 11, part 2)'
+    (content text/plain in message 11, part 2)'
 
 start_test '-nocheck, the default'
 run_test 'mhlist last -part 2 -noheader -check -nocheck' \
 
 start_test '-nocheck, the default'
 run_test 'mhlist last -part 2 -noheader -check -nocheck' \
index 7235d6f..e886618 100755 (executable)
@@ -240,7 +240,7 @@ mv -f "$MH_TEST_DIR/$$.tmp" "$msgfile"
 run_test 'mhstore last -part 2 -check' \
 'storing message 11 part 2 as file 11.2.txt
 mhstore: content integrity suspect (digest mismatch) -- continuing
 run_test 'mhstore last -part 2 -check' \
 'storing message 11 part 2 as file 11.2.txt
 mhstore: content integrity suspect (digest mismatch) -- continuing
-         (content text/plain in message 11, part 2)'
+    (content text/plain in message 11, part 2)'
 check "$expected" 11.2.txt 'keep first'
 
 # check -nocheck, the default
 check "$expected" 11.2.txt 'keep first'
 
 # check -nocheck, the default
index 778d805..dc33bc0 100644 (file)
@@ -161,7 +161,7 @@ void
 content_error (char *what, CT ct, char *fmt, ...)
 {
     va_list arglist;
 content_error (char *what, CT ct, char *fmt, ...)
 {
     va_list arglist;
-    int        i, len, buflen;
+    int        len, buflen;
     char *bp, buffer[BUFSIZ];
     CI ci;
 
     char *bp, buffer[BUFSIZ];
     CI ci;
 
@@ -204,10 +204,8 @@ content_error (char *what, CT ct, char *fmt, ...)
        buflen -= len;
     }
 
        buflen -= len;
     }
 
-    i = strlen (invo_name) + 2;
-
     /* Now add content type and subtype */
     /* Now add content type and subtype */
-    snprintf (bp, buflen, "\n%*s(content %s/%s", i, "",
+    snprintf (bp, buflen, "\n    (content %s/%s",
        ci->ci_type, ci->ci_subtype);
     len = strlen (bp);
     bp += len;
        ci->ci_type, ci->ci_subtype);
     len = strlen (bp);
     bp += len;