Skip to content

Commit

Permalink
Fix length of allocated strings
Browse files Browse the repository at this point in the history
len(fgrep) = 6
len(grep -F) = 8
  • Loading branch information
mads256h committed Feb 29, 2024
1 parent 1484810 commit e9a9408
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions CONFIG/src/atlconf_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions CONFIG/src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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='",
Expand Down Expand Up @@ -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='",
Expand Down Expand Up @@ -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='",
Expand Down

0 comments on commit e9a9408

Please sign in to comment.