[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] NULL-terminate list of arguments in server-mode
From: |
Alexey Mahotkin |
Subject: |
[PATCH] NULL-terminate list of arguments in server-mode |
Date: |
Sun, 23 Sep 2001 01:32:32 +0400 (MSD) |
I've been implementing the "acl" command and was bitten by the fact
that serve_argument() does not NULL-terminates a list of arguments
received from the client. This does no harm because existing
server-side code always uses something like
for (i = 0; i < argc; i++)
and never something like
for (; *argv; argv++)
I'd like to do the latter (and it's obviously good to have more
traditional argv[]), so here is the patch:
2001-09-23 Alexey Mahotkin <alexm@hsys.msk.ru>
* server.c (serve_argument): NULL-terminate list of arguments
received from client.
--- server.c Sat Sep 8 19:33:24 2001
+++ server.c.new Sun Sep 23 01:25:26 2001
@@ -2120,7 +2120,7 @@
if (error_pending()) return;
- if (argument_vector_size <= argument_count)
+ if (argument_vector_size <= argument_count + 1)
{
argument_vector_size *= 2;
argument_vector =
@@ -2140,6 +2140,7 @@
}
strcpy (p, arg);
argument_vector[argument_count++] = p;
+ argument_vector[argument_count] = NULL;
}
static void
--alexm
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] NULL-terminate list of arguments in server-mode,
Alexey Mahotkin <=