[bitlbee] Fix crash when no SRV record is provided (#668190)

Matej Cepl mcepl at fedoraproject.org
Sun Jan 9 08:37:44 UTC 2011


commit 1ec8b27d0ab842de13d1460b70351b516afbfd61
Author: Matěj Cepl <mcepl at redhat.com>
Date:   Sun Jan 9 09:36:14 2011 +0100

    Fix crash when no SRV record is provided (#668190)
    
    fix by Ricky Zhou

 bitlbee-libresolv.patch |   18 ++++++++++--------
 bitlbee.spec            |    5 ++++-
 2 files changed, 14 insertions(+), 9 deletions(-)
---
diff --git a/bitlbee-libresolv.patch b/bitlbee-libresolv.patch
index 356780f..4164463 100644
--- a/bitlbee-libresolv.patch
+++ b/bitlbee-libresolv.patch
@@ -16,7 +16,7 @@ index edc4adb..1b1336d 100755
  			fi
  		fi
 diff --git a/lib/misc.c b/lib/misc.c
-index 05192d9..556fe1a 100644
+index 05192d9..cf2083f 100644
 --- a/lib/misc.c
 +++ b/lib/misc.c
 @@ -1,8 +1,8 @@
@@ -132,7 +132,7 @@ index 05192d9..556fe1a 100644
  void srv_free( struct ns_srv_reply **srv )
  {
  	int i;
-@@ -586,6 +536,119 @@ void srv_free( struct ns_srv_reply **srv )
+@@ -586,6 +536,121 @@ void srv_free( struct ns_srv_reply **srv )
  	g_free( srv );
  }
  
@@ -194,8 +194,6 @@ index 05192d9..556fe1a 100644
 +
 +    count = ntohs(header->ancount);
 +
-+    results = g_new(struct ns_srv_reply *, count + 1);
-+
 +    n = 0;
 +    while (count-- > 0 && p < end) {
 +        len = dn_skipname(p, end);
@@ -228,13 +226,17 @@ index 05192d9..556fe1a 100644
 +        }
 +        p += len;
 +
++        /* n + 2 includes an entry for the terminating NULL. */
++        results = g_renew(struct ns_srv_reply *, results, n + 2);
 +        results[n++] = reply;
 +    }
 +
-+    results[n] = NULL;
++    if (results != NULL) {
++        results[n] = NULL;
 +
-+    /* Order by priority. */
-+    qsort(results, n, sizeof(struct ns_srv_reply *), srv_compare);
++        /* Order by priority. */
++        qsort(results, n, sizeof(struct ns_srv_reply *), srv_compare);
++    }
 +
 +    return results;
 +
@@ -252,7 +254,7 @@ index 05192d9..556fe1a 100644
  /* Word wrapping. Yes, I know this isn't UTF-8 clean. I'm willing to take the risk. */
  char *word_wrap( const char *msg, int line_len )
  {
-@@ -728,3 +791,22 @@ char **split_command_parts( char *command )
+@@ -728,3 +793,22 @@ char **split_command_parts( char *command )
  	
  	return cmd;
  }
diff --git a/bitlbee.spec b/bitlbee.spec
index 52bb37c..7920675 100644
--- a/bitlbee.spec
+++ b/bitlbee.spec
@@ -1,7 +1,7 @@
 Summary:           IRC to other chat networks gateway
 Name:              bitlbee
 Version:           3.0.1
-Release:           7%{?dist}
+Release:           8%{?dist}
 License:           GPLv2+ and MIT
 Group:             System Environment/Daemons
 URL:               http://www.bitlbee.org/
@@ -192,6 +192,9 @@ rm -rf $RPM_BUILD_ROOT
 %endif
 
 %changelog
+* Sun Jan 09 2011 Matěj Cepl <mcepl at redhat.com> - 3.0.1-8
+- Fix crash when no SRV record is provided (#668190); fix by Ricky Zhou
+
 * Wed Dec 29 2010 Matěj Cepl <mcepl at redhat.com> - 3.0.1-7
 - Adding more missing systemd-support pieces and eliminate xinetd on F<15
 


More information about the scm-commits mailing list