Hi,

Several cases of wrong argument to snprintf were detected by the compiler and gave me a warning.

In src/hal/classicladder/drawing.c:62:
void CreateVarNameForElement() uses snprintf() with a sizeof denoting the size of the *pointer* and not the buffer. The function cannot know the size of the buffer. The caller seems to have declared a 50 char buffer (line 335), but that information is not forwarded.

A similar problem is in line 222, again using the sizeof a pointer. The buffer is previously malloc'ed in line 218.

In src/hal/classicladder/files_project.c are four instances where the return value of fgets is ignored. This is bad and potentially very wrong.

A similar ignored return value is in src/hal/classicladder/serial_linux.c:194 where the return value of write() is ignored. It will fail if, for example, a signal interferes.Even worse, the file is opened with O_NDELAY (== O_NONBLOCK), which means that it simply may fail on the call going to block.

And then hal/classicladder/classicladder_gtk.c:740 'cr' may be uninitialized. The call to cairo_destroy() in line 761 would get a garbage pointer.

--
Greetings Bertho

(disclaimers are disclaimed)


_______________________________________________
Emc-developers mailing list
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to