summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2012-12-19 13:37:13 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2012-12-19 13:37:13 +0000
commit3115e4b7bdfd52732ad2fa75fc787b7b81a9508c (patch)
tree81c8a013d88ef91c9d8ed631828c094b41a2da7c
parent8af8785d3c2ccbf6463b54d0c4142467fe65414b (diff)
Fix a purely theoretical NULL-pointer dereference in the case that we
would be able to receive multiple SCM_RIGHTS messages. ok claudio@ gilles@
-rw-r--r--lib/libutil/imsg.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libutil/imsg.c b/lib/libutil/imsg.c
index 05e57c7e2d4..b506297b73f 100644
--- a/lib/libutil/imsg.c
+++ b/lib/libutil/imsg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imsg.c,v 1.2 2012/06/02 21:46:53 gilles Exp $ */
+/* $OpenBSD: imsg.c,v 1.3 2012/12/19 13:37:12 reyk Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -103,7 +103,7 @@ again:
(char *)CMSG_DATA(cmsg)) / sizeof(int);
for (i = 0; i < j; i++) {
fd = ((int *)CMSG_DATA(cmsg))[i];
- if (i == 0) {
+ if (ifd != NULL) {
ifd->fd = fd;
TAILQ_INSERT_TAIL(&ibuf->fds, ifd,
entry);