X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/2415c95ae0e5c6c43644a9c79f1d2e1b71ce56ba..b52fcdb5415dd37207406bab2ee6cfff9d772449:/sbr/encode_rfc2047.c?ds=inline diff --git a/sbr/encode_rfc2047.c b/sbr/encode_rfc2047.c index 953f6e5c..2c8a3f0d 100644 --- a/sbr/encode_rfc2047.c +++ b/sbr/encode_rfc2047.c @@ -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) { - 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++ = '\n'; + *q++ = '\n'; *q = '\0'; @@ -550,6 +556,7 @@ field_encode_address(const char *name, char **value, int encoding, char *tmpbuf = NULL; size_t tmpbufsize = 0; struct mailname *mn; + char errbuf[BUFSIZ]; /* * Because these are addresses, we need to handle them individually. @@ -566,7 +573,8 @@ field_encode_address(const char *name, char **value, int encoding, output = add(" ", output); for (groupflag = 0; (mp = getname(*value)); ) { - if ((mn = getm(mp, NULL, 0, AD_HOST, NULL)) == NULL) { + if ((mn = getm(mp, NULL, 0, errbuf, sizeof(errbuf))) == NULL) { + advise(NULL, "%s: %s", errbuf, mp); errflag++; continue; }