Fix a regression in parsing -X commands.

Details discussed in #25813.
This commit is contained in:
Sadrul Habib Chowdhury
2010-03-20 20:52:50 -04:00
parent 0d0a3e392a
commit f7adfae856

View File

@@ -1645,9 +1645,17 @@ struct msg *mp;
for (fc = fullcmd; n > 0; n--)
{
int len = strlen(p);
/* Make sure there's enough room */
if (fc + len + 3 > fullcmd + sizeof(fullcmd) - 1)
{
queryflag = -1;
return;
}
*fc++ = '"';
strncpy(fc, p, fullcmd + sizeof(fullcmd) - fc - 1);
p += len + 1;
fc += len;
*fc++ = '"';
*fc++ = ' ';
}
if (fc != fullcmd)