Merge pull request from GHSA-mg26-v6qh-x48q

v1.23
Brad House 9 months ago
parent f587fcbc8c
commit 76cefd5a79
  1. 8
      src/lib/ares__read_line.c

@ -59,6 +59,14 @@ ares_status_t ares__read_line(FILE *fp, char **buf, size_t *bufsize)
return (offset != 0) ? 0 : (ferror(fp)) ? ARES_EFILE : ARES_EOF; return (offset != 0) ? 0 : (ferror(fp)) ? ARES_EFILE : ARES_EOF;
} }
len = offset + ares_strlen(*buf + offset); len = offset + ares_strlen(*buf + offset);
/* Probably means there was an embedded NULL as the first character in
* the line, throw away line */
if (len == 0) {
offset = 0;
continue;
}
if ((*buf)[len - 1] == '\n') { if ((*buf)[len - 1] == '\n') {
(*buf)[len - 1] = 0; (*buf)[len - 1] = 0;
break; break;

Loading…
Cancel
Save