The extraheaderrc format doesn't allow data after the header
colon. Other OSes may insert extra characters other than \n,
so, remove them all.
goto extra_headers_done;
}
while (fgets(buf, BUFFSIZE, exh) != NULL) {
- lastc = strlen(buf) - 1; /* remove trailing \n */
- buf[lastc] = (buf[lastc] == '\n')? '\0': buf[lastc];
- --lastc;
+ lastc = strlen(buf) - 1; /* remove trailing control chars */
+ while (lastc >= 0 && buf[lastc] != ':')
+ buf[lastc--] = '\0';
if (lastc > 0 && buf[0] != '#' && buf[lastc] == ':') {
buf[lastc] = '\0'; /* remove trailing : for comparison */
if (custom_header_is_allowed(buf)) {