- Fix Out of Bounds Write in sldns_bget_token_par(),

reported by X41 D-Sec.
This commit is contained in:
W.C.A. Wijngaards 2019-11-19 16:54:44 +01:00
parent 51c23b0209
commit fa23ee8f31
2 changed files with 9 additions and 1 deletions

View file

@ -15,6 +15,8 @@
sldns_str2wire_dname_buf_origin(), reported by X41 D-Sec. sldns_str2wire_dname_buf_origin(), reported by X41 D-Sec.
- Fix Out of Bounds Read in sldns_str2wire_dname(), - Fix Out of Bounds Read in sldns_str2wire_dname(),
reported by X41 D-Sec. reported by X41 D-Sec.
- Fix Out of Bounds Write in sldns_bget_token_par(),
reported by X41 D-Sec.
18 November 2019: Wouter 18 November 2019: Wouter
- In unbound-host use separate variable for get_option to please - In unbound-host use separate variable for get_option to please

View file

@ -325,8 +325,14 @@ sldns_bget_token_par(sldns_buffer *b, char *token, const char *delim,
if (c == '\n' && p != 0) { if (c == '\n' && p != 0) {
/* in parentheses */ /* in parentheses */
/* do not write ' ' if we want to skip spaces */ /* do not write ' ' if we want to skip spaces */
if(!(skipw && (strchr(skipw, c)||strchr(skipw, ' ')))) if(!(skipw && (strchr(skipw, c)||strchr(skipw, ' ')))) {
/* check for space for the space character */
if (limit > 0 && (i >= limit || (size_t)(t-token) >= limit)) {
*t = '\0';
return -1;
}
*t++ = ' '; *t++ = ' ';
}
lc = c; lc = c;
continue; continue;
} }