diff options
author | Martin Schröder <martin@oneiros.de> | 2007-07-11 21:13:59 +0000 |
---|---|---|
committer | Martin Schröder <martin@oneiros.de> | 2007-07-11 21:13:59 +0000 |
commit | 7bf56e6bfcd7b204b3507dc9acaaaa3dce2cbcdb (patch) | |
tree | 5f8b4be4a21dc917441e4d2a1ec3e6fe25fd0192 /Build/source/libs/obsdcompat/bsd-asprintf.c | |
parent | c0da09fd6e4a542610245624c185a66f5ec814b2 (diff) |
Imported pdftex 1.40.4
git-svn-id: svn://tug.org/texlive/trunk@4561 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/obsdcompat/bsd-asprintf.c')
-rw-r--r-- | Build/source/libs/obsdcompat/bsd-asprintf.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Build/source/libs/obsdcompat/bsd-asprintf.c b/Build/source/libs/obsdcompat/bsd-asprintf.c index 67480139ebd..00fa0dfd8a7 100644 --- a/Build/source/libs/obsdcompat/bsd-asprintf.c +++ b/Build/source/libs/obsdcompat/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; |