mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
- Better fix for infinite loop when reading multiple lines of input on
a broken remote control socket, by treating a zero byte line the same as transmission end. Addesses #947 and #948.
This commit is contained in:
parent
908e1cb11a
commit
07149f576a
2 changed files with 15 additions and 10 deletions
|
|
@ -590,13 +590,13 @@ ssl_read_line(RES* res, char* buf, size_t max)
|
||||||
while(1) {
|
while(1) {
|
||||||
ssize_t rr = recv(res->fd, buf+len, 1, 0);
|
ssize_t rr = recv(res->fd, buf+len, 1, 0);
|
||||||
if(rr <= 0) {
|
if(rr <= 0) {
|
||||||
if(rr == 0 && len != 0) {
|
if(rr == 0) {
|
||||||
buf[len] = 0;
|
buf[len] = 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if(errno == EINTR || errno == EAGAIN)
|
if(errno == EINTR || errno == EAGAIN)
|
||||||
continue;
|
continue;
|
||||||
log_err("could not recv: %s",
|
if(rr < 0) log_err("could not recv: %s",
|
||||||
sock_strerror(errno));
|
sock_strerror(errno));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -1223,8 +1223,8 @@ do_zones_add(RES* ssl, struct local_zones* zones)
|
||||||
char buf[2048];
|
char buf[2048];
|
||||||
int num = 0;
|
int num = 0;
|
||||||
while(ssl_read_line(ssl, buf, sizeof(buf))) {
|
while(ssl_read_line(ssl, buf, sizeof(buf))) {
|
||||||
if(buf[0] == 0x04 && buf[1] == 0)
|
if(buf[0] == 0 || (buf[0] == 0x04 && buf[1] == 0))
|
||||||
break; /* end of transmission */
|
break; /* zero byte line or end of transmission */
|
||||||
if(!perform_zone_add(ssl, zones, buf)) {
|
if(!perform_zone_add(ssl, zones, buf)) {
|
||||||
if(!ssl_printf(ssl, "error for input line: %s\n", buf))
|
if(!ssl_printf(ssl, "error for input line: %s\n", buf))
|
||||||
return;
|
return;
|
||||||
|
|
@ -1272,8 +1272,8 @@ do_zones_remove(RES* ssl, struct local_zones* zones)
|
||||||
char buf[2048];
|
char buf[2048];
|
||||||
int num = 0;
|
int num = 0;
|
||||||
while(ssl_read_line(ssl, buf, sizeof(buf))) {
|
while(ssl_read_line(ssl, buf, sizeof(buf))) {
|
||||||
if(buf[0] == 0x04 && buf[1] == 0)
|
if(buf[0] == 0 || (buf[0] == 0x04 && buf[1] == 0))
|
||||||
break; /* end of transmission */
|
break; /* zero byte line or end of transmission */
|
||||||
if(!perform_zone_remove(ssl, zones, buf)) {
|
if(!perform_zone_remove(ssl, zones, buf)) {
|
||||||
if(!ssl_printf(ssl, "error for input line: %s\n", buf))
|
if(!ssl_printf(ssl, "error for input line: %s\n", buf))
|
||||||
return;
|
return;
|
||||||
|
|
@ -1336,8 +1336,8 @@ do_datas_add(RES* ssl, struct local_zones* zones)
|
||||||
char buf[2048];
|
char buf[2048];
|
||||||
int num = 0, line = 0;
|
int num = 0, line = 0;
|
||||||
while(ssl_read_line(ssl, buf, sizeof(buf))) {
|
while(ssl_read_line(ssl, buf, sizeof(buf))) {
|
||||||
if(buf[0] == 0x04 && buf[1] == 0)
|
if(buf[0] == 0 || (buf[0] == 0x04 && buf[1] == 0))
|
||||||
break; /* end of transmission */
|
break; /* zero byte line or end of transmission */
|
||||||
line++;
|
line++;
|
||||||
if(perform_data_add(ssl, zones, buf, line))
|
if(perform_data_add(ssl, zones, buf, line))
|
||||||
num++;
|
num++;
|
||||||
|
|
@ -1376,8 +1376,8 @@ do_datas_remove(RES* ssl, struct local_zones* zones)
|
||||||
char buf[2048];
|
char buf[2048];
|
||||||
int num = 0;
|
int num = 0;
|
||||||
while(ssl_read_line(ssl, buf, sizeof(buf))) {
|
while(ssl_read_line(ssl, buf, sizeof(buf))) {
|
||||||
if(buf[0] == 0x04 && buf[1] == 0)
|
if(buf[0] == 0 || (buf[0] == 0x04 && buf[1] == 0))
|
||||||
break; /* end of transmission */
|
break; /* zero byte line or end of transmission */
|
||||||
if(!perform_data_remove(ssl, zones, buf)) {
|
if(!perform_data_remove(ssl, zones, buf)) {
|
||||||
if(!ssl_printf(ssl, "error for input line: %s\n", buf))
|
if(!ssl_printf(ssl, "error for input line: %s\n", buf))
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,8 @@
|
||||||
|
13 October 2023: George
|
||||||
|
- Better fix for infinite loop when reading multiple lines of input on
|
||||||
|
a broken remote control socket, by treating a zero byte line the
|
||||||
|
same as transmission end. Addesses #947 and #948.
|
||||||
|
|
||||||
12 October 2023: Wouter
|
12 October 2023: Wouter
|
||||||
- Merge #944: Disable EDNS DO.
|
- Merge #944: Disable EDNS DO.
|
||||||
Disable the EDNS DO flag in upstream requests. This can be helpful
|
Disable the EDNS DO flag in upstream requests. This can be helpful
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue