[Nut-upsdev] [Patch] upssched broken in version 2.6.4 with command with two arguments
Oliver Schonefeld
schonefeld at ids-mannheim.de
Tue Jul 3 14:42:11 UTC 2012
Hi,
the last commit to upssched.c (Merge Coverity branch, r3555) broke
upssched with commands that have a second argument.
If a command with a second argument is used, "enc" in line 697 is not an
empty buffer and snprintfcat() just appends some stuff, i.e. the
following command
CANCEL onbatt online
becomes
onlineCANCEL "onbatt" "online"
and is then sent to the pipe-fd.
The attached patch replaces snprintfcat() with snprintf() and fixes the
problem.
Best,
Oliver
--
Oliver Schonefeld
Institut für Deutsche Sprache, Zentrale Forschung
R5, 6-13, D-68161 Mannheim
+49-(0)621-1581-451 | http://www.ids-mannheim.de
-------------- next part --------------
diff -u -r nut-2.6.4.orig/clients/upssched.c nut-2.6.4/clients/upssched.c
--- nut-2.6.4.orig/clients/upssched.c 2012-05-11 10:29:33.000000000 +0200
+++ nut-2.6.4/clients/upssched.c 2012-07-03 16:22:24.000000000 +0200
@@ -694,7 +694,7 @@
snprintfcat(buf, sizeof(buf), " \"%s\"",
pconf_encode(arg2, enc, sizeof(enc)));
- snprintfcat(enc, sizeof(enc), "%s\n", buf);
+ snprintf(enc, sizeof(enc), "%s\n", buf);
/* see if the parent needs to be started (and maybe start it) */
More information about the Nut-upsdev
mailing list