From 4ee374a42f4482c9d2bab9791c5869ec0d4133b0 Mon Sep 17 00:00:00 2001 From: Mads Mogensen Date: Wed, 28 Feb 2024 12:53:14 +0100 Subject: [PATCH] Fix length of allocated strings len(fgrep) = 6 len(grep -F) = 8 --- CONFIG/src/atlconf_misc.c | 6 +++--- CONFIG/src/config.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CONFIG/src/atlconf_misc.c b/CONFIG/src/atlconf_misc.c index 0f6e979..db46981 100644 --- a/CONFIG/src/atlconf_misc.c +++ b/CONFIG/src/atlconf_misc.c @@ -700,7 +700,7 @@ char *NameWithoutPath(char *file) int GetIntVers(char *str, int *nskip) { - char ln[64]; + char ln[128]; int i, j; *nskip = 0; @@ -870,7 +870,7 @@ int CompIsMinGW(char *comp) { char *cmnd, *res; int i; - i = strlen(comp) + 24; + i = strlen(comp) + 26; cmnd = malloc(sizeof(char)*i); assert(cmnd); sprintf(cmnd, "%s -v 2>&1 | grep -F mingw", comp); @@ -899,7 +899,7 @@ int CompIsAppleGcc(char *comp) if (CompIsGcc(comp)) { int i; - i = strlen(comp) + 24; + i = strlen(comp) + 26; cmnd = malloc(sizeof(char)*i); assert(cmnd); sprintf(cmnd, "%s -v 2>&1 | grep -F Apple", comp); diff --git a/CONFIG/src/config.c b/CONFIG/src/config.c index c7c11ff..cb481db 100644 --- a/CONFIG/src/config.c +++ b/CONFIG/src/config.c @@ -10,7 +10,7 @@ char *GetStrProbe(int verb, char *targarg, char *prb, char *id) char *ln, *res; int i; - i = strlen(targarg) + strlen(prb) + strlen(id) + 48; + i = strlen(targarg) + strlen(prb) + strlen(id) + 50; ln = malloc(i*sizeof(char)); assert(ln); sprintf(ln, "make IRun_%s args=\"-v %d %s\" | grep -F '%s='", @@ -44,7 +44,7 @@ int GetIntProbe(int verb, char *targarg, char *prb, char *id, int N) char *ln, *res; int iret=0, i; - i = strlen(targarg) + strlen(prb) + strlen(id) + 48; + i = strlen(targarg) + strlen(prb) + strlen(id) + 50; ln = malloc(i*sizeof(char)); assert(ln); sprintf(ln, "make IRun_%s args=\"-v %d %s\" | grep -F '%s='", @@ -75,7 +75,7 @@ int GetIntProbeSure(int verb, char *targarg, char *prb, char *id, char *ln, *res; int iret=0, ierr, i; - i = strlen(targarg) + strlen(prb) + strlen(id) + 48; + i = strlen(targarg) + strlen(prb) + strlen(id) + 50; ln = malloc(i*sizeof(char)); assert(ln); sprintf(ln, "make IRun_%s args=\"-v %d %s\" | grep -F '%s='",