[Mono-bugs] [Bug 375580] Buffer overrun plus infinite loop on partial write to serial port - patch included

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Mar 31 18:21:46 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=375580

User miguel at novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=375580#c1





--- Comment #1 from Miguel de Icaza <miguel at novell.com>  2008-03-31 16:21:45 MST ---
I agree that this routine looks buggy, but I have applied a slightly different
change:

* I agree with this:

-       n = count - offset;
+       n = count;

* I added the check for interrupted writes:

-               t = write(fd, buffer + offset, count);
+               do {
+                       t = write (fd, buffer + offset, n);
+               } while (t == -1 && errno == EINTR);
+
+               if (t < 0)
+                       return -1;

This will retry writes as long as they are interrupted, but will abort if there
is another kind of error.

The updating of n will remain as-is


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list