]> diplodocus.org Git - nmh/blobdiff - sbr/encode_rfc2047.c
Editing of man/post.man.
[nmh] / sbr / encode_rfc2047.c
index 537a275e345c14e8535d50ce2b1fbbeffca66f75..d1ccd2e973c8bd5a6d889f18e62899e6a56ff443 100644 (file)
@@ -281,16 +281,22 @@ field_encode_quoted(const char *name, char **value, const char *charset,
             * allow for the encoded output.
             */
            if (column + (utf8len(p) * 3) > ENCODELINELIMIT - 2) {
             * allow for the encoded output.
             */
            if (column + (utf8len(p) * 3) > ENCODELINELIMIT - 2) {
-               newline = 1;
+               newline = 1;
            }
        }
     }
 
            }
        }
     }
 
+    if (q == NULL) {
+       /* This should never happen, but just in case.  Found by
+          clang static analyzer. */
+       admonish (NULL, "null output encoding for %s", *value);
+       return 1;
+    }
     *q++ = '?';
     *q++ = '=';
 
     if (prefixlen)
     *q++ = '?';
     *q++ = '=';
 
     if (prefixlen)
-       *q++ = '\n';
+       *q++ = '\n';
 
     *q = '\0';
 
 
     *q = '\0';
 
@@ -568,7 +574,7 @@ field_encode_address(const char *name, char **value, int encoding,
 
     for (groupflag = 0; (mp = getname(*value)); ) {
        if ((mn = getm(mp, NULL, 0, errbuf, sizeof(errbuf))) == NULL) {
 
     for (groupflag = 0; (mp = getname(*value)); ) {
        if ((mn = getm(mp, NULL, 0, errbuf, sizeof(errbuf))) == NULL) {
-           advise(mp, "%s", errbuf);
+           advise(NULL, "%s: %s", errbuf, mp);
            errflag++;
            continue;
        }
            errflag++;
            continue;
        }
@@ -737,7 +743,7 @@ do_reformat:
        groupflag = mn->m_ingrp;
 
        if (mn->m_gname) {
        groupflag = mn->m_ingrp;
 
        if (mn->m_gname) {
-           cp = add(mn->m_gname, NULL);
+           cp = mh_xstrdup(mn->m_gname);
        }
 
        if (reformat) {
        }
 
        if (reformat) {
@@ -792,11 +798,8 @@ do_reformat:
     output = NULL;
 
 out:
     output = NULL;
 
 out:
-
-    if (tmpbuf)
-       free(tmpbuf);
-    if (output)
-       free(output);
+    mh_xfree(tmpbuf);
+    mh_xfree(output);
 
     return errflag > 0;
 }
 
     return errflag > 0;
 }