Download raw body.
ypldap: fix endless loop
Hi,
If the connection behind ldap->fd is closed, this leads into an endless
loop and 100% CPU consumption here. Also, an error of evbuffer_add(3)
should not ignored here.
ok?
bye,
Jan
Index: aldap.c
===================================================================
RCS file: /cvs/src/usr.sbin/ypldap/aldap.c,v
diff -u -p -r1.49 aldap.c
--- aldap.c 13 Oct 2022 04:55:33 -0000 1.49
+++ aldap.c 30 Jun 2026 07:43:40 -0000
@@ -405,11 +405,12 @@ aldap_parse(struct aldap *ldap)
} else
ret = read(ldap->fd, rbuf, sizeof(rbuf));
- if (ret == -1) {
+ if (ret == -1 || ret == 0) {
goto parsefail;
}
- evbuffer_add(ldap->buf, rbuf, ret);
+ if (evbuffer_add(ldap->buf, rbuf, ret) == -1)
+ goto parsefail;
}
if (EVBUFFER_LENGTH(ldap->buf) > 0) {
ypldap: fix endless loop