]>
Commit | Line | Data |
---|---|---|
3671422b JB |
1 | From 80047d74644eeda55c451aea59951eb502649cf4 Mon Sep 17 00:00:00 2001 |
2 | From: Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> | |
3 | Date: Thu, 29 Jul 2010 19:43:08 +0200 | |
4 | Subject: [PATCH 7/8] check vasprintf return value | |
5 | ||
6 | --- | |
7 | lib/libutil/asprintf.c | 3 ++- | |
8 | lib/util/casprintf.c | 3 ++- | |
9 | 2 files changed, 4 insertions(+), 2 deletions(-) | |
10 | ||
11 | diff --git a/lib/libutil/asprintf.c b/lib/libutil/asprintf.c | |
12 | index a79cd81..5a06f0f 100644 | |
13 | --- a/lib/libutil/asprintf.c | |
14 | +++ b/lib/libutil/asprintf.c | |
15 | @@ -121,7 +121,8 @@ xmlrpc_vasprintf(const char ** const retvalP, | |
16 | char * string; | |
17 | ||
18 | #if HAVE_ASPRINTF | |
19 | - vasprintf(&string, fmt, varargs); | |
20 | + if (vasprintf(&string, fmt, varargs) < 0) | |
21 | + string = NULL; | |
22 | #else | |
23 | simpleVasprintf(&string, fmt, varargs); | |
24 | #endif | |
25 | diff --git a/lib/util/casprintf.c b/lib/util/casprintf.c | |
26 | index 643f145..9139253 100644 | |
27 | --- a/lib/util/casprintf.c | |
28 | +++ b/lib/util/casprintf.c | |
29 | @@ -99,7 +99,8 @@ cvasprintf(const char ** const retvalP, | |
30 | char * string; | |
31 | ||
32 | #if HAVE_ASPRINTF | |
33 | - vasprintf(&string, fmt, varargs); | |
34 | + if (vasprintf(&string, fmt, varargs) < 0) | |
35 | + string = NULL; | |
36 | #else | |
37 | simpleVasprintf(&string, fmt, varargs); | |
38 | #endif | |
39 | -- | |
40 | 1.7.3.4 | |
41 |