Package: libnet-rawip-perl
Version: 0.20-1
Severity: important
Tags: patch

Hi,

host_to_ip() has a memory leak of a few bytes; when a script sends stuff 
intensively
over the course of a few hours this means Perl hits the 4GB memory limit and 
everything
dies. The patch below is trivial, and seems to fix the issue for us.

--- libnet-rawip-perl-0.20.orig/util.c
+++ libnet-rawip-perl-0.20/util.c
@@ -116,8 +116,7 @@
 host_to_ip (char *host_name)
 {
   struct hostent *target;
-  u_long *resolved_ip;
-  resolved_ip = (u_long *) malloc (sizeof (u_long));
+  u_long resolved_ip;
 
   if ((target = gethostbyname (host_name)) == NULL)
     {
@@ -125,8 +124,8 @@
     }
   else
     {
-      bcopy (target->h_addr, resolved_ip, sizeof (struct in_addr));
-      return ntohl ((u_long) * resolved_ip);
+      memcpy((char *)&resolved_ip, target->h_addr, sizeof (struct in_addr));
+      return ntohl (resolved_ip);
     }
 }


-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.20.4
Locale: LANG=en_DK.UTF-8, LC_CTYPE=en_DK.UTF-8 (charmap=UTF-8)


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to