From 2eaea99054fd65ad03f1fe9679a318253eaa8dd6 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Wed, 12 Jul 2006 23:41:33 +1000 Subject: - (dtucker) [openbsd-compat/bsd-asprintf.c openbsd-compat/port-aix.c openbsd-compat/rresvport.c] More errno.h. --- openbsd-compat/bsd-asprintf.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'openbsd-compat/bsd-asprintf.c') diff --git a/openbsd-compat/bsd-asprintf.c b/openbsd-compat/bsd-asprintf.c index 5ca01f80f..1178296f8 100644 --- a/openbsd-compat/bsd-asprintf.c +++ b/openbsd-compat/bsd-asprintf.c @@ -21,6 +21,9 @@ #ifndef HAVE_VASPRINTF +#include +#include + #ifndef VA_COPY # ifdef HAVE_VA_COPY # define VA_COPY(dest, src) va_copy(dest, src) -- cgit v1.2.3 From f78fb54412e34c2647c1bc9f895af00620f42730 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Sun, 6 Aug 2006 21:25:24 +1000 Subject: - (dtucker) [openbsd-compat/{bsd-asprintf.c,bsd-openpty.c,bsd-snprintf.c, glob.c}] Include stdlib.h for malloc and friends in compat code. --- ChangeLog | 4 +++- openbsd-compat/bsd-asprintf.c | 1 + openbsd-compat/bsd-openpty.c | 2 ++ openbsd-compat/bsd-snprintf.c | 2 ++ openbsd-compat/glob.c | 2 ++ 5 files changed, 10 insertions(+), 1 deletion(-) (limited to 'openbsd-compat/bsd-asprintf.c') diff --git a/ChangeLog b/ChangeLog index 60a1fd753..1efc7ba36 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ 2006086 - (dtucker) [defines.h] With the includes.h changes we no longer get the name clash on "YES" so we can remove the workaround for it. + - (dtucker) [openbsd-compat/{bsd-asprintf.c,bsd-openpty.c,bsd-snprintf.c, + glob.c}] Include stdlib.h for malloc and friends in compat code. 20060805 - (djm) OpenBSD CVS Sync @@ -5198,4 +5200,4 @@ - (djm) Trim deprecated options from INSTALL. Mention UsePAM - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu -$Id: ChangeLog,v 1.4475 2006/08/06 11:23:27 dtucker Exp $ +$Id: ChangeLog,v 1.4476 2006/08/06 11:25:24 dtucker Exp $ diff --git a/openbsd-compat/bsd-asprintf.c b/openbsd-compat/bsd-asprintf.c index 1178296f8..67480139e 100644 --- a/openbsd-compat/bsd-asprintf.c +++ b/openbsd-compat/bsd-asprintf.c @@ -23,6 +23,7 @@ #include #include +#include #ifndef VA_COPY # ifdef HAVE_VA_COPY diff --git a/openbsd-compat/bsd-openpty.c b/openbsd-compat/bsd-openpty.c index a2f2fda60..c0cde6b1f 100644 --- a/openbsd-compat/bsd-openpty.c +++ b/openbsd-compat/bsd-openpty.c @@ -37,6 +37,8 @@ #include +#include + #ifdef HAVE_SYS_STAT_H # include #endif diff --git a/openbsd-compat/bsd-snprintf.c b/openbsd-compat/bsd-snprintf.c index 9fdf4d3f0..47cbcff67 100644 --- a/openbsd-compat/bsd-snprintf.c +++ b/openbsd-compat/bsd-snprintf.c @@ -108,6 +108,8 @@ #if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) +#include +#include #include #ifdef HAVE_LONG_DOUBLE diff --git a/openbsd-compat/glob.c b/openbsd-compat/glob.c index 907235353..ec16b1108 100644 --- a/openbsd-compat/glob.c +++ b/openbsd-compat/glob.c @@ -37,10 +37,12 @@ #include #include + #include #include #include #include +#include #include #include -- cgit v1.2.3 From be6db83462c0d4a7067ab303644440026c93d685 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Tue, 5 Dec 2006 22:58:09 +1100 Subject: - (djm) [bsd-asprintf.c] Better test for bad vsnprintf lengths; ok dtucker@ --- ChangeLog | 3 ++- openbsd-compat/bsd-asprintf.c | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'openbsd-compat/bsd-asprintf.c') diff --git a/ChangeLog b/ChangeLog index a790a988d..c14cf03d8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,7 @@ - (djm) [auth.c] Fix NULL pointer dereference in fakepw(). Crash would occur if the server did not have the privsep user and an invalid user tried to login and both privsep and krb5 auth are disabled; ok dtucker@ + - (djm) [bsd-asprintf.c] Better test for bad vsnprintf lengths; ok dtucker@ 20061108 - (dtucker) OpenBSD CVS Sync @@ -2616,4 +2617,4 @@ OpenServer 6 and add osr5bigcrypt support so when someone migrates passwords between UnixWare and OpenServer they will still work. OK dtucker@ -$Id: ChangeLog,v 1.4590 2006/12/04 22:08:54 djm Exp $ +$Id: ChangeLog,v 1.4591 2006/12/05 11:58:09 djm Exp $ diff --git a/openbsd-compat/bsd-asprintf.c b/openbsd-compat/bsd-asprintf.c index 67480139e..00fa0dfd8 100644 --- a/openbsd-compat/bsd-asprintf.c +++ b/openbsd-compat/bsd-asprintf.c @@ -39,7 +39,8 @@ #define INIT_SZ 128 -int vasprintf(char **str, const char *fmt, va_list ap) +int +vasprintf(char **str, const char *fmt, va_list ap) { int ret = -1; va_list ap2; @@ -53,7 +54,7 @@ int vasprintf(char **str, const char *fmt, va_list ap) ret = vsnprintf(string, INIT_SZ, fmt, ap2); if (ret >= 0 && ret < INIT_SZ) { /* succeeded with initial alloc */ *str = string; - } else if (ret == INT_MAX) { /* shouldn't happen */ + } else if (ret == INT_MAX || ret < 0) { /* Bad length */ goto fail; } else { /* bigger than initial, realloc allowing for nul */ len = (size_t)ret + 1; -- cgit v1.2.3