summaryrefslogtreecommitdiff
path: root/src/socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/socket.c')
-rw-r--r--src/socket.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/socket.c b/src/socket.c
index 9dbf461..619aebb 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -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)