[asterisk-commits] russell: branch group/issue_11972 r105896 - /team/group/issue_11972/main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Mar 4 17:50:02 CST 2008


Author: russell
Date: Tue Mar  4 17:50:02 2008
New Revision: 105896

URL: http://svn.digium.com/view/asterisk?view=rev&rev=105896
Log:
Add some fd sanity checking to server read/write
(from jamesgolovich's patch on issue #11972)

Modified:
    team/group/issue_11972/main/tcptls.c

Modified: team/group/issue_11972/main/tcptls.c
URL: http://svn.digium.com/view/asterisk/team/group/issue_11972/main/tcptls.c?view=diff&rev=105896&r1=105895&r2=105896
==============================================================================
--- team/group/issue_11972/main/tcptls.c (original)
+++ team/group/issue_11972/main/tcptls.c Tue Mar  4 17:50:02 2008
@@ -83,6 +83,12 @@
 
 HOOK_T ast_tcptls_server_read(struct ast_tcptls_server_instance *ser, void *buf, size_t count)
 {
+	if (ser->fd == -1) {
+		ast_log(LOG_ERROR, "server_read called with an fd of -1\n");
+		errno = EIO;
+		return -1;
+	}
+
 #ifdef DO_SSL
 	if (ser->ssl)
 		return ssl_read(ser->ssl, buf, count);
@@ -92,6 +98,12 @@
 
 HOOK_T ast_tcptls_server_write(struct ast_tcptls_server_instance *ser, void *buf, size_t count)
 {
+	if (ser->fd == -1) {
+		ast_log(LOG_ERROR, "server_write called with an fd of -1\n");
+		errno = EIO;
+		return -1;
+	}
+
 #ifdef DO_SSL
 	if (ser->ssl)
 		return ssl_write(ser->ssl, buf, count);




More information about the asterisk-commits mailing list