From: Roy Marples Date: Wed, 26 Nov 2014 15:34:14 +0000 (+0000) Subject: Fix a memory error. X-Git-Tag: v6.6.4~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=538449efbc0700e9ced3f15f5bc93ac1b5629984;p=thirdparty%2Fdhcpcd.git Fix a memory error. --- diff --git a/script.c b/script.c index 0f6b360e..31e80fab 100644 --- a/script.c +++ b/script.c @@ -288,8 +288,8 @@ make_env(const struct interface *ifp, const char *reason, char ***argv) elen = 13; #define EMALLOC(i, l) if ((env[(i)] = malloc((l))) == NULL) goto eexit; - /* Make our env */ - env = calloc(1, sizeof(char *) * (elen + 1)); + /* Make our env + space for profile, wireless and debug */ + env = calloc(1, sizeof(char *) * (elen + 3 + 1)); if (env == NULL) goto eexit; e = strlen("interface") + strlen(ifp->name) + 2; @@ -378,7 +378,7 @@ make_env(const struct interface *ifp, const char *reason, char ***argv) snprintf(env[elen++], e, "syslog_debug=true"); } if (*ifp->profile) { - e = strlen("profile=") + strlen(ifp->profile) + 2; + e = strlen("profile=") + strlen(ifp->profile) + 1; EMALLOC(elen, e); snprintf(env[elen++], e, "profile=%s", ifp->profile); }