diff options
author | cem <cem@FreeBSD.org> | 2016-05-12 05:12:24 +0000 |
---|---|---|
committer | cem <cem@FreeBSD.org> | 2016-05-12 05:12:24 +0000 |
commit | 3571021d227752c84e8467a6742a88dd30204fd0 (patch) | |
tree | 6ccdfc83b502dd4ad21458a2616f14c1a2f855b7 | |
parent | 5f28b4bf85db3547f4e18351426519ea90c664c6 (diff) | |
download | FreeBSD-src-3571021d227752c84e8467a6742a88dd30204fd0.zip FreeBSD-src-3571021d227752c84e8467a6742a88dd30204fd0.tar.gz |
rtadvd(8): Fix use-after-close in cm_handler_client
cm_send() closes 'fd' on error. In that case, bail out early without trying to
recv from or close 'fd' again.
Reported by: Coverity
CID: 1006078
Sponsored by: EMC / Isilon Storage Division
-rw-r--r-- | usr.sbin/rtadvd/control_client.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.sbin/rtadvd/control_client.c b/usr.sbin/rtadvd/control_client.c index 33efe37..ca5cb68 100644 --- a/usr.sbin/rtadvd/control_client.c +++ b/usr.sbin/rtadvd/control_client.c @@ -92,9 +92,11 @@ cm_handler_client(int fd, int state, char *buf_orig) case CM_STATE_MSG_DISPATCH: cm->cm_version = CM_VERSION; error = cm_send(fd, buf); - if (error) + if (error) { syslog(LOG_WARNING, "<%s> cm_send()", __func__); + return (-1); + } state = CM_STATE_ACK_WAIT; break; case CM_STATE_ACK_WAIT: |