From a06e717e19f5748310bd7dc6d9d9803030c1e2bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sun, 6 Nov 2011 00:47:01 +0200 Subject: Check asprintf() return value. --- common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'common.c') diff --git a/common.c b/common.c index 114a101..0b8cd27 100644 --- a/common.c +++ b/common.c @@ -389,7 +389,8 @@ bool ParseVar(const char *Text, const char *Name, std::string &Value) const char *ptr1, *ptr2; char *str; bool res = false; - asprintf(&str, ",%s=", Name); + if (asprintf(&str, ",%s=", Name) == -1) + return res; if ((ptr1 = strstr(Text, str)) || (strncmp(ptr1 = Text, str + 1, strlen(str) - 1) == 0)) { if (ptr1 == Text) --ptr1; -- cgit v1.2.3