[asterisk-commits] qwell: trunk r40757 - /trunk/channels/chan_skinny.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Aug 21 00:35:00 MST 2006


Author: qwell
Date: Mon Aug 21 02:34:59 2006
New Revision: 40757

URL: http://svn.digium.com/view/asterisk?rev=40757&view=rev
Log:
Fix a potential integer signedness problem.
Also fix some locking issues I found at the same time.

Issue 7770, original patch by alamantia

Modified:
    trunk/channels/chan_skinny.c

Modified: trunk/channels/chan_skinny.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_skinny.c?rev=40757&r1=40756&r2=40757&view=diff
==============================================================================
--- trunk/channels/chan_skinny.c (original)
+++ trunk/channels/chan_skinny.c Mon Aug 21 02:34:59 2006
@@ -3927,12 +3927,19 @@
 		res = read(s->fd, s->inbuf, 4);
 		if (res < 0) {
 			ast_log(LOG_WARNING, "read() returned error: %s\n", strerror(errno));
+			ast_mutex_unlock(&s->lock);
 			return res;
 		} else if (res != 4) {
 			ast_log(LOG_WARNING, "Skinny Client sent less data than expected.  Expected 4 but got %d.\n", res);
+			ast_mutex_unlock(&s->lock);
 			return -1;
 		}
 		dlen = letohl(*(int *)s->inbuf);
+		if (dlen < 0) {
+			ast_log(LOG_WARNING, "Skinny Client sent invalid data.\n");
+			ast_mutex_unlock(&s->lock);
+			return -1;
+		}
 		if (dlen+8 > sizeof(s->inbuf)) {
 			dlen = sizeof(s->inbuf) - 8;
 		}



More information about the asterisk-commits mailing list