Hello,

There is a bug in rtnet-0.9.9/examples/generic/linux_server.c as well
as in current SVN. 

Details:
The variable clientLength is not initialized before it is passed to
recvfrom. Yet, according to "man 2 recvfrom" (debian etch) it should be
"initialized to the size of the buffer associated with from".
I tried the program without my bugfix (below) and it did not work
(AFAIR "recvfrom() invalid parameter" or wrong address displayed after
RCV), with the fix it worked as expected.

Fix:
just add clientLength initialization. see attached patch.

Bye,
Wolfgang
--- svn/examples/generic/linux_server.c	2007-10-17 11:37:44.000000000 +0200
+++ fixed/examples/generic/linux_server.c	2007-10-16 20:39:55.000000000 +0200
@@ -49,6 +49,7 @@
     }
 
     for (;;) {
+        clientLength=sizeof(clientName);
         size = recvfrom(udpSocket, mesg, MAX_MESG_SIZE, 0,
                         (struct sockaddr *)&clientName, &clientLength);
         if (size == -1) {
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
RTnet-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rtnet-developers

Reply via email to