Skip to content

Commit

Permalink
FvwmScript: fix bogus string length
Browse files Browse the repository at this point in the history
Ensure the malloc()d space to the string is computed using its length
and not some random magic number.

Fixes #356
  • Loading branch information
ThomasAdam committed Dec 14, 2020
1 parent e4d7b3b commit 397075e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion modules/FvwmScript/FvwmScript.c
Original file line number Diff line number Diff line change
Expand Up @@ -1337,7 +1337,8 @@ void ReadFvwmScriptArg(int argc, char **argv,int IsFather)
else
{ /* Son case */
x11base->TabScriptId[0] = fxcalloc(sizeof(char), strlen(argv[7]));
x11base->TabScriptId[0] = strncpy(x11base->TabScriptId[0], argv[7], 900);
x11base->TabScriptId[0] = strncpy(x11base->TabScriptId[0], argv[7],
strlen(argv[7] + 1));
x11base->TabScriptId[1] = argv[7];
myatom=XInternAtom(dpy, x11base->TabScriptId[1], True);
XSetSelectionOwner(dpy, myatom, x11base->win, CurrentTime);
Expand Down

0 comments on commit 397075e

Please sign in to comment.