]> code.citadel.org Git - citadel.git/commitdiff
CONF STOREVAL fix off-by-one string termination
authorArt Cancro <ajc@citadel.org>
Mon, 13 May 2024 20:42:58 +0000 (20:42 +0000)
committerArt Cancro <ajc@citadel.org>
Mon, 13 May 2024 20:42:58 +0000 (20:42 +0000)
The fact that this makes the server crash hard, proves that
this command hasn't seen any use.  In fact it probably doesn't
even work.

citadel/server/control.c

index b3df0ae3fbf97dd78beddf0302c493a67926413a..9be3addeb75cd95d36e9116308711f9360f86c94 100644 (file)
@@ -636,7 +636,7 @@ void cmd_conf(char *argbuf) {
                        char *valbuf = malloc(bytes + 1);
                        cprintf("%d %d\n", SEND_BINARY, bytes);
                        client_read(valbuf, bytes);
-                       valbuf[bytes+1] = 0;
+                       valbuf[bytes] = 0;
                        CtdlSetConfigStr(confname, valbuf);
                        free(valbuf);
                }