summaryrefslogtreecommitdiff
path: root/sbin/dhclient/dhclient.c
diff options
context:
space:
mode:
authorTobias Stoeckmann <tobias@cvs.openbsd.org>2014-01-16 21:41:23 +0000
committerTobias Stoeckmann <tobias@cvs.openbsd.org>2014-01-16 21:41:23 +0000
commit6ed9aa2cf5ac1cabb397f2b5bbba349072644e86 (patch)
treecb85b6a6890a58fa3eca4b8de449dfd1190d2051 /sbin/dhclient/dhclient.c
parent846bcd5e86ca6c15e6e18d888d286536572b565a (diff)
Avoid size_t overflow while reading /etc/resolv.conf.tail.
ok krw
Diffstat (limited to 'sbin/dhclient/dhclient.c')
-rw-r--r--sbin/dhclient/dhclient.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c
index 0b5768d40ea..684d19c5ea4 100644
--- a/sbin/dhclient/dhclient.c
+++ b/sbin/dhclient/dhclient.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhclient.c,v 1.281 2013/12/30 03:36:17 krw Exp $ */
+/* $OpenBSD: dhclient.c,v 1.282 2014/01/16 21:41:22 tobias Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
@@ -59,6 +59,7 @@
#include <sys/ioctl.h>
#include <sys/uio.h>
+#include <limits.h>
#include <poll.h>
#include <pwd.h>
#include <resolv.h>
@@ -494,7 +495,7 @@ main(int argc, char *argv[])
error("Cannot stat /etc/resolv.conf.tail: %s",
strerror(errno));
} else {
- if (sb.st_size > 0) {
+ if (sb.st_size > 0 && sb.st_size < SIZE_MAX) {
config->resolv_tail = calloc(1, sb.st_size + 1);
if (config->resolv_tail == NULL) {
error("no memory for resolv.conf.tail "