There is a chance that the input string is larger than size, and on VMS,
this wasn't checked and could possibly be exploitable (slim chance, but still)
This commit is contained in:
parent
405ac901c9
commit
b093ef7445
13
apps/apps.c
13
apps/apps.c
@ -310,9 +310,16 @@ void program_name(char *in, char *out, int size)
|
|||||||
|
|
||||||
q=strrchr(p,'.');
|
q=strrchr(p,'.');
|
||||||
if (q == NULL)
|
if (q == NULL)
|
||||||
q = in+size;
|
q = p + strlen(p);
|
||||||
strncpy(out,p,q-p);
|
strncpy(out,p,size-1);
|
||||||
out[q-p]='\0';
|
if (q-p >= size)
|
||||||
|
{
|
||||||
|
out[size-1]='\0';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
out[q-p]='\0';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
void program_name(char *in, char *out, int size)
|
void program_name(char *in, char *out, int size)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user