[hackers] [sbase] Fix uninitialized use of ret in expr(1) || sin
commit 7b8d7fb78edc79a99f0c2a67b5a8ca725ec56424
Author: sin <sin_AT_2f30.org>
Date: Sun Nov 16 14:43:10 2014 +0000
Fix uninitialized use of ret in expr(1)
diff --git a/expr.c b/expr.c
index 49fa040..3e0cd8e 100644
--- a/expr.c
+++ b/expr.c
_AT_@ -117,10 +117,11 @@ match(Val vstr, Val vregx)
if (re.re_nsub) {
len = matches[1].rm_eo - matches[1].rm_so + 1;
- ret = emalloc(len); /* TODO: free ret */
- d = strtoimax(ret, &p, 10);
+ ret = malloc(len); /* TODO: free ret */
+ if (!ret)
+ enprintf(3, "malloc:");
strlcpy(ret, str + matches[1].rm_so, len);
-
+ d = strtoimax(ret, &p, 10);
if (*ret && !*p)
return (Val){ NULL, d };
return (Val){ ret, 0 };
Received on Sun Nov 16 2014 - 18:41:00 CET
This archive was generated by hypermail 2.3.0
: Sun Nov 16 2014 - 18:48:09 CET