summaryrefslogtreecommitdiff
path: root/usr.sbin/ospfd/buffer.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2005-04-05 12:59:19 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2005-04-05 12:59:19 +0000
commit75e08cafc7189a5824e9cbbc1d7b307340fd4518 (patch)
tree78032f19e9f462de034766deb222a9a298d9d5c7 /usr.sbin/ospfd/buffer.c
parentad3024c93cd9c78f50888e66fabc2f41c2ff642b (diff)
Set errno in case buf_realloc() fails because the limit of the buffer is
reached.
Diffstat (limited to 'usr.sbin/ospfd/buffer.c')
-rw-r--r--usr.sbin/ospfd/buffer.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/ospfd/buffer.c b/usr.sbin/ospfd/buffer.c
index eea84a5cdf0..8a70cf3ac63 100644
--- a/usr.sbin/ospfd/buffer.c
+++ b/usr.sbin/ospfd/buffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: buffer.c,v 1.4 2005/03/23 11:36:34 henning Exp $ */
+/* $OpenBSD: buffer.c,v 1.5 2005/04/05 12:59:18 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -73,8 +73,10 @@ buf_realloc(struct buf *buf, size_t len)
u_char *b;
/* on static buffers max is eq size and so the following fails */
- if (buf->wpos + len > buf->max)
+ if (buf->wpos + len > buf->max) {
+ errno = ENOMEM;
return (-1);
+ }
b = realloc(buf->buf, buf->wpos + len);
if (b == NULL)