Oliver Schonefeld
2012-Jul-03 14:42 UTC
[Nut-upsdev] [Patch] upssched broken in version 2.6.4 with command with two arguments
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) */
Vladimir Volovich
2012-Jul-03 15:37 UTC
[Nut-upsdev] [Patch] upssched broken in version 2.6.4 with command with two arguments
Hi Oliver, Thank you. I've rebuilt the nut packages with your patch, and confirmed that the problem is fixed: I get the proper system shutdown. Best wishes, Vladimir On Tue, Jul 3, 2012 at 6:33 PM, Oliver Schonefeld < schonefeld at ids-mannheim.de> wrote:> 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 -------------- An HTML attachment was scrubbed... URL: <http://lists.alioth.debian.org/pipermail/nut-upsdev/attachments/20120703/be9a5f79/attachment.html>
Arnaud Quette
2012-Jul-04 19:01 UTC
[Nut-upsdev] [Patch] upssched broken in version 2.6.4 with command with two arguments
2012/7/3 Oliver Schonefeld <schonefeld at ids-mannheim.de>> Hi, >Hi Oliver,> 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. >thanks a lot for your report. the issue and solution are both confirmed. I've applied your patch to the trunk (r3670), and I'm now considering a 2.6.5 release for soon. note that there are efforts underway to have unit tests, along with integrating the regression test suite, run with our buildbots: http://buildbot.networkupstools.org/ this would provide a decent CI (continuous integration) and prevent us from future regression. cheers, Arnaud -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.alioth.debian.org/pipermail/nut-upsdev/attachments/20120704/97275411/attachment.html>
Reasonably Related Threads
- Synthesize low batt (LB) fron SNMP UPS which does not support this?
- UPSC based Windows Client
- andersen plot vs score process or scaled Schoenfeld residuals to test for proporti0nal hazards
- Synthesize low batt (LB) fron SNMP UPS which does not support this?
- UPSC based Windows Client