[Nut-upsdev] Stack corruption in newhidups.c

Arnaud Quette aquette.dev at gmail.com
Fri Sep 29 16:59:36 UTC 2006


ooops, mea culpa, I have this report from Ales Nosek (from SuSE)
sitting in my draft stack.

@Peter: can you also have a look at the 2nd one, and backport both in Testing?

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Hello,

I send a patch for nut 2.0.4. It fixes these compiler warnings:

newhidups.c(576): warning #175: subscript out of range

rhino.c: In function 'upsdrv_initinfo':
rhino.c:497: warning: call to __builtin___strcpy_chk will always
overflow destination buffer
rhino.c:503: warning: call to __builtin___strcpy_chk will always
overflow destination buffer
rhino.c:509: warning: call to __builtin___strcpy_chk will always
overflow destination buffer
rhino.c:515: warning: call to __builtin___strcpy_chk will always
overflow destination buffer

Ales Nosek
--- drivers/newhidups.c
+++ drivers/newhidups.c
@@ -578,7 +578,7 @@

 void upsdrv_initups(void)
 {
-                char *regex_array[5];
+                char *regex_array[6];
                int r;
                int i;

--- drivers/rhino.h
+++ drivers/rhino.h
@@ -59,7 +59,7 @@
 /* data vetor from received and configuration data package - not used yet
 unsigned char Dados[ 161 ]; */
 /* identification group */
-char Model[12];
+char Model[15];
 int RhinoModel; /*, imodel; */
 int PotenciaNominal, PowerFactor;
 /* input group */
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Arnaud
-- 
Linux / Unix Expert - MGE UPS SYSTEMS - R&D Dpt
Network UPS Tools (NUT) Project Leader - http://www.networkupstools.org/
Debian Developer - http://people.debian.org/~aquette/
OpenSource Developer - http://arnaud.quette.free.fr/



More information about the Nut-upsdev mailing list