[Pkg-silc-commits] r297 - in /silc-client/trunk: debian/changelog lib/silccore/silcpacket.c lib/silcutil/silcbuffmt.c lib/silcutil/silcutil.c lib/silcutil/unix/silcunixnet.c

lunar at users.alioth.debian.org lunar at users.alioth.debian.org
Fri Jul 11 15:26:02 UTC 2008


Author: lunar
Date: Fri Jul 11 15:26:02 2008
New Revision: 297

URL: http://svn.debian.org/wsvn/pkg-silc/?sc=1&rev=297
Log:
Backport upstream fixes found in silc-server 1.1.11 for irssi-plugin-silc.

Modified:
    silc-client/trunk/debian/changelog
    silc-client/trunk/lib/silccore/silcpacket.c
    silc-client/trunk/lib/silcutil/silcbuffmt.c
    silc-client/trunk/lib/silcutil/silcutil.c
    silc-client/trunk/lib/silcutil/unix/silcunixnet.c

Modified: silc-client/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-silc/silc-client/trunk/debian/changelog?rev=297&op=diff
==============================================================================
--- silc-client/trunk/debian/changelog (original)
+++ silc-client/trunk/debian/changelog Fri Jul 11 15:26:02 2008
@@ -1,3 +1,9 @@
+silc-client (1.1.4-2) UNRELEASED; urgency=low
+
+  * Backport upstream fixes found in silc-server 1.1.11 for irssi-plugin-silc.
+
+ -- Jérémy Bobbio <lunar at debian.org>  Fri, 11 Jul 2008 15:25:22 +0000
+
 silc-client (1.1.4-1) unstable; urgency=low
 
   * New upstream release:

Modified: silc-client/trunk/lib/silccore/silcpacket.c
URL: http://svn.debian.org/wsvn/pkg-silc/silc-client/trunk/lib/silccore/silcpacket.c?rev=297&op=diff
==============================================================================
--- silc-client/trunk/lib/silccore/silcpacket.c (original)
+++ silc-client/trunk/lib/silccore/silcpacket.c Fri Jul 11 15:26:02 2008
@@ -723,8 +723,8 @@
 			    (void *)&ps->sc)) {
     ps->sc = silc_calloc(1, sizeof(*ps->sc));
     if (!ps->sc) {
+      silc_mutex_unlock(engine->lock);
       silc_packet_stream_destroy(ps);
-      silc_mutex_unlock(engine->lock);
       return NULL;
     }
     ps->sc->engine = engine;
@@ -735,8 +735,8 @@
     if (!inbuf) {
       silc_free(ps->sc);
       ps->sc = NULL;
+      silc_mutex_unlock(engine->lock);
       silc_packet_stream_destroy(ps);
-      silc_mutex_unlock(engine->lock);
       return NULL;
     }
     silc_buffer_reset(inbuf);
@@ -746,8 +746,8 @@
       silc_buffer_free(inbuf);
       silc_free(ps->sc);
       ps->sc = NULL;
+      silc_mutex_unlock(engine->lock);
       silc_packet_stream_destroy(ps);
-      silc_mutex_unlock(engine->lock);
       return NULL;
     }
     silc_dlist_add(ps->sc->inbufs, inbuf);
@@ -758,8 +758,8 @@
       silc_dlist_del(ps->sc->inbufs, inbuf);
       silc_free(ps->sc);
       ps->sc = NULL;
+      silc_mutex_unlock(engine->lock);
       silc_packet_stream_destroy(ps);
-      silc_mutex_unlock(engine->lock);
       return NULL;
     }
   }
@@ -901,17 +901,18 @@
 
   if (!stream->udp) {
     /* Delete from engine */
-    engine = stream->sc->engine;
-    silc_mutex_lock(engine->lock);
-    silc_list_del(engine->streams, stream);
-
-    /* Remove per scheduler context, if it is not used anymore */
     if (stream->sc) {
+      engine = stream->sc->engine;
+      silc_mutex_lock(engine->lock);
+      silc_list_del(engine->streams, stream);
+
+      /* Remove per scheduler context, if it is not used anymore */
       stream->sc->stream_count--;
       if (!stream->sc->stream_count)
 	silc_hash_table_del(engine->contexts, stream->sc->schedule);
-    }
-    silc_mutex_unlock(engine->lock);
+
+      silc_mutex_unlock(engine->lock);
+    }
 
     /* Destroy the underlaying stream */
     if (stream->stream)

Modified: silc-client/trunk/lib/silcutil/silcbuffmt.c
URL: http://svn.debian.org/wsvn/pkg-silc/silc-client/trunk/lib/silcutil/silcbuffmt.c?rev=297&op=diff
==============================================================================
--- silc-client/trunk/lib/silcutil/silcbuffmt.c (original)
+++ silc-client/trunk/lib/silcutil/silcbuffmt.c Fri Jul 11 15:26:02 2008
@@ -365,7 +365,8 @@
 	UNFORMAT_HAS_SPACE(src, len2);
 	if (silc_likely(len2 && x)) {
 	  *x = silc_scalloc(stack, len2 + 1, sizeof(unsigned char));
-	  memcpy(*x, src->data, len2);
+	  if (*x)
+	    memcpy(*x, src->data, len2);
 	}
 	silc_buffer_pull(src, len2);
 	break;
@@ -478,7 +479,8 @@
 	UNFORMAT_HAS_SPACE(src, len2);
 	if (silc_likely(x && len2)) {
 	  *x = silc_scalloc(stack, len2 + 1, sizeof(unsigned char));
-	  memcpy(*x, src->data, len2);
+	  if (*x)
+	    memcpy(*x, src->data, len2);
 	}
 	silc_buffer_pull(src, len2);
 	break;
@@ -493,7 +495,8 @@
 	UNFORMAT_HAS_SPACE(src, len2);
 	if (silc_likely(x && len2)) {
 	  *x = silc_scalloc(stack, len2 + 1, sizeof(unsigned char));
-	  memcpy(*x, src->data, len2);
+	  if (*x)
+	    memcpy(*x, src->data, len2);
 	}
 	silc_buffer_pull(src, len2);
 	break;
@@ -521,7 +524,8 @@
 	UNFORMAT_HAS_SPACE(src, len2);
 	if (silc_likely(x && len2)) {
 	  *x = silc_scalloc(stack, len2 + 1, sizeof(unsigned char));
-	  memcpy(*x, src->data, len2);
+	  if (*x)
+	    memcpy(*x, src->data, len2);
 	}
 	silc_buffer_pull(src, len2);
 	break;
@@ -571,7 +575,8 @@
 	  *len3 = len2;
 	if (x && len2) {
 	  *x = silc_scalloc(stack, len2 + 1, sizeof(unsigned char));
-	  memcpy(*x, src->data, len2);
+	  if (*x)
+	    memcpy(*x, src->data, len2);
 	}
 	silc_buffer_pull(src, len2);
 	break;
@@ -589,7 +594,8 @@
 	  *len3 = len2;
 	if (x && len2) {
 	  *x = silc_scalloc(stack, len2 + 1, sizeof(unsigned char));
-	  memcpy(*x, src->data, len2);
+	  if (*x)
+	    memcpy(*x, src->data, len2);
 	}
 	silc_buffer_pull(src, len2);
 	break;
@@ -630,9 +636,10 @@
 	SILC_GET32_MSB(len2, src->data);
 	silc_buffer_pull(src, 4);
 	UNFORMAT_HAS_SPACE(src, len2);
-	silc_buffer_sformat(stack, x,
-			    SILC_STR_DATA(src->data, len2),
-			    SILC_STR_END);
+	if (silc_buffer_sformat(stack, x,
+				SILC_STR_DATA(src->data, len2),
+				SILC_STR_END) < 0)
+	  goto fail;
 	silc_buffer_pull(src, len2);
       }
       break;

Modified: silc-client/trunk/lib/silcutil/silcutil.c
URL: http://svn.debian.org/wsvn/pkg-silc/silc-client/trunk/lib/silcutil/silcutil.c?rev=297&op=diff
==============================================================================
--- silc-client/trunk/lib/silcutil/silcutil.c (original)
+++ silc-client/trunk/lib/silcutil/silcutil.c Fri Jul 11 15:26:02 2008
@@ -119,8 +119,10 @@
   if (!user && !fqdn)
     return 0;
 
-  memset(user, 0, user_size);
-  memset(fqdn, 0, fqdn_size);
+  if (user)
+    memset(user, 0, user_size);
+  if (user)
+    memset(fqdn, 0, fqdn_size);
 
   if (!string)
     return 0;
@@ -469,7 +471,7 @@
 {
   unsigned char *fingerprint, *cp;
   unsigned int len, blocks, i;
-  
+
   if (!data || !data_len)
     return NULL;
 
@@ -484,7 +486,7 @@
   cp = fingerprint = silc_calloc(len, sizeof(*fingerprint));
   if (!cp)
     return NULL;
-  
+
   for (i = 0; i < data_len; i++) {
     silc_snprintf(cp, len, "%02X", data[i]);
     cp += 2;
@@ -497,7 +499,7 @@
   }
   i--;
   if ((i + 1) % 10 == 0)
-    *(--cp) = '\0';  
+    *(--cp) = '\0';
   if ((i + 1) % 2 == 0)
     *(--cp) = '\0';
 

Modified: silc-client/trunk/lib/silcutil/unix/silcunixnet.c
URL: http://svn.debian.org/wsvn/pkg-silc/silc-client/trunk/lib/silcutil/unix/silcunixnet.c?rev=297&op=diff
==============================================================================
--- silc-client/trunk/lib/silcutil/unix/silcunixnet.c (original)
+++ silc-client/trunk/lib/silcutil/unix/silcunixnet.c Fri Jul 11 15:26:02 2008
@@ -701,6 +701,9 @@
       silc_async_free(conn->op);
   }
 
+  if (conn->sock && conn->status != SILC_NET_OK)
+    silc_net_close_connection(conn->sock);
+
   return SILC_FSM_FINISH;
 }
 




More information about the Pkg-silc-commits mailing list