r36268 - in /trunk/libnet-arp-perl: ARP.xs Changes arp.h arp.h.orig arp_lookup_bsd.c arp_lookup_linux.c debian/changelog debian/control get_mac_bsd.c get_mac_linux.c send_packet_bsd.c send_packet_linux.c
ryan52-guest at users.alioth.debian.org
ryan52-guest at users.alioth.debian.org
Sun May 24 04:59:50 UTC 2009
Author: ryan52-guest
Date: Sun May 24 04:59:45 2009
New Revision: 36268
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=36268
Log:
* New upstream release
* Add myself to Uploaders
Added:
trunk/libnet-arp-perl/arp.h.orig
- copied unchanged from r36267, branches/upstream/libnet-arp-perl/current/arp.h.orig
Modified:
trunk/libnet-arp-perl/ARP.xs
trunk/libnet-arp-perl/Changes
trunk/libnet-arp-perl/arp.h
trunk/libnet-arp-perl/arp_lookup_bsd.c
trunk/libnet-arp-perl/arp_lookup_linux.c
trunk/libnet-arp-perl/debian/changelog
trunk/libnet-arp-perl/debian/control
trunk/libnet-arp-perl/get_mac_bsd.c
trunk/libnet-arp-perl/get_mac_linux.c
trunk/libnet-arp-perl/send_packet_bsd.c
trunk/libnet-arp-perl/send_packet_linux.c
Modified: trunk/libnet-arp-perl/ARP.xs
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-arp-perl/ARP.xs?rev=36268&op=diff
==============================================================================
--- trunk/libnet-arp-perl/ARP.xs (original)
+++ trunk/libnet-arp-perl/ARP.xs Sun May 24 04:59:45 2009
@@ -36,12 +36,12 @@
int
send_packet(dev, sip, dip, smac, dmac, type)
- unsigned char *dev;
- unsigned char *sip;
- unsigned char *dip;
- unsigned char *smac;
- unsigned char *dmac;
- unsigned char *type;
+ const char *dev;
+ const char *sip;
+ const char *dip;
+ const char *smac;
+ const char *dmac;
+ const char *type;
CODE:
int uid;
@@ -190,9 +190,9 @@
char *
get_mac(dev)
- unsigned char *dev;
+ const char *dev;
CODE:
- char tmp[20] = "unknown";
+ char tmp[HEX_HW_ADDR_LEN];
if(SOCK_TYPE == SOCK_RAW)
{
@@ -211,11 +211,11 @@
char *
arp_lookup(dev, ip)
- unsigned char *dev;
- unsigned char *ip;
+ const char *dev;
+ const char *ip;
CODE:
- char tmp[20] = "unknown";
+ char tmp[HEX_HW_ADDR_LEN];
if(SOCK_TYPE == SOCK_RAW)
{
Modified: trunk/libnet-arp-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-arp-perl/Changes?rev=36268&op=diff
==============================================================================
--- trunk/libnet-arp-perl/Changes (original)
+++ trunk/libnet-arp-perl/Changes Sun May 24 04:59:45 2009
@@ -1,3 +1,9 @@
+Changes between 1.0.3 and 1.0.5
+
+buffer overflow patch by Franck Joncourt <franck.mail at dthconnex.com>
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+
Changes between 1.0.3 and 1.0.4
fix FTBFS due to unaligned assignment problems by Niko Tyni <ntyni at debian.org>
Modified: trunk/libnet-arp-perl/arp.h
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-arp-perl/arp.h?rev=36268&op=diff
==============================================================================
--- trunk/libnet-arp-perl/arp.h (original)
+++ trunk/libnet-arp-perl/arp.h Sun May 24 04:59:45 2009
@@ -42,6 +42,10 @@
#endif
#define IP_ALEN 4
+/* Length of the hardware address in the standard hex-digits-and-colons
+ * notation (null terminated string) */
+#define HEX_HW_ADDR_LEN 18
+
// ARP Header Struktur
struct my_arphdr {
u_short hw_type; // hardware type
@@ -56,3 +60,9 @@
};
extern struct ether_addr *ether_aton (__const char *__asc) __THROW;
+extern int get_mac_linux(const char *dev, char *mac);
+extern int get_mac_bsd(const char *dev, char *mac);
+extern int arp_lookup_linux(const char *dev, const char *ip, char *mac);
+extern int arp_lookup_bsd(const char *dev, const char *ip, char *mac);
+extern int send_packet_linux(const char *dev, u_char *packet, u_int packetsize);
+extern int send_packet_bsd(const char *dev, u_char *packet, u_int packetsize);
Modified: trunk/libnet-arp-perl/arp_lookup_bsd.c
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-arp-perl/arp_lookup_bsd.c?rev=36268&op=diff
==============================================================================
--- trunk/libnet-arp-perl/arp_lookup_bsd.c (original)
+++ trunk/libnet-arp-perl/arp_lookup_bsd.c Sun May 24 04:59:45 2009
@@ -28,25 +28,23 @@
#include <netinet/if_ether.h>
#include <arpa/inet.h>
#include <sys/sysctl.h>
+#include <sys/types.h>
+#include "arp.h"
#define ROUNDUP(a) \
((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
-int arp_lookup_bsd(u_char *dev, u_char *ip, char *mac)
+int arp_lookup_bsd(const char *dev, const char *ip, char *mac)
{
int mib[6];
size_t needed;
char *lim, *buf, *next;
- if(strlen(mac) > 0)
- strcpy(mac,"unknown");
- else
+ if ( (mac == NULL) || (dev == NULL) || (ip == NULL) )
return -1;
- if(strlen(ip) == 0)
- return -1;
-
- strcpy(mac,"unknown");
+ strncpy(mac,"unknown", HEX_HW_ADDR_LEN);
+ mac[HEX_HW_ADDR_LEN-1] = '\0';
mib[0] = CTL_NET;
mib[1] = PF_ROUTE;
Modified: trunk/libnet-arp-perl/arp_lookup_linux.c
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-arp-perl/arp_lookup_linux.c?rev=36268&op=diff
==============================================================================
--- trunk/libnet-arp-perl/arp_lookup_linux.c (original)
+++ trunk/libnet-arp-perl/arp_lookup_linux.c Sun May 24 04:59:45 2009
@@ -20,10 +20,12 @@
#include <stdio.h>
#include <string.h>
+#include <sys/types.h>
+#include "arp.h"
#define _PATH_PROCNET_ARP "/proc/net/arp"
-int arp_lookup_linux(char *dev, char *ip, char *mac)
+int arp_lookup_linux(const char *dev, const char *ip, char *mac)
{
FILE *fp;
char ipaddr[100];
@@ -32,18 +34,16 @@
char mask[100];
char device[100];
int num, type, flags;
-
- if(strlen(mac) > 0)
- strcpy(mac,"unknown");
- else
+
+ if ( (mac == NULL) || (dev == NULL) || (ip == NULL) )
return -1;
- if(strlen(ip) == 0)
- return -1;
-
+ strncpy(mac,"unknown", HEX_HW_ADDR_LEN);
+ mac[HEX_HW_ADDR_LEN-1] = '\0';
+
if ((fp = fopen(_PATH_PROCNET_ARP, "r")) == NULL) {
perror(_PATH_PROCNET_ARP);
- return (-1);
+ return -1;
}
/* Bypass header -- read until newline */
@@ -57,14 +57,16 @@
if (num < 4)
break;
- if ((strlen(dev) == 0 || strcmp(dev, device) == 0) && strcmp(ip, ipaddr) == 0)
+ else if ( ((strlen(dev) == 0) || (strcmp(dev, device) == 0))
+ && (strcmp(ip, ipaddr) == 0) )
{
- strcpy(mac, hwa);
+ strncpy(mac, hwa, HEX_HW_ADDR_LEN);
+ mac[HEX_HW_ADDR_LEN-1] = '\0';
break;
}
- strcpy(mac, "unknown");
}
}
fclose(fp);
+ return 0;
}
Modified: trunk/libnet-arp-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-arp-perl/debian/changelog?rev=36268&op=diff
==============================================================================
--- trunk/libnet-arp-perl/debian/changelog (original)
+++ trunk/libnet-arp-perl/debian/changelog Sun May 24 04:59:45 2009
@@ -1,3 +1,10 @@
+libnet-arp-perl (1.0.5-1) UNRELEASED; urgency=low
+
+ * New upstream release
+ * Add myself to Uploaders
+
+ -- Ryan Niebur <ryanryan52 at gmail.com> Sat, 23 May 2009 21:59:36 -0700
+
libnet-arp-perl (1.0.4-1) unstable; urgency=low
* New upstream release.
Modified: trunk/libnet-arp-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-arp-perl/debian/control?rev=36268&op=diff
==============================================================================
--- trunk/libnet-arp-perl/debian/control (original)
+++ trunk/libnet-arp-perl/debian/control Sun May 24 04:59:45 2009
@@ -4,7 +4,7 @@
Build-Depends: debhelper (>= 7), perl (>= 5.8.8-6), quilt (>= 0.40), net-tools
Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
Uploaders: Gunnar Wolf <gwolf at debian.org>, Niko Tyni <ntyni at debian.org>,
- Franck Joncourt <franck.mail at dthconnex.com>
+ Franck Joncourt <franck.mail at dthconnex.com>, Ryan Niebur <ryanryan52 at gmail.com>
Standards-Version: 3.8.1
Homepage: http://search.cpan.org/dist/Net-ARP/
Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libnet-arp-perl/
Modified: trunk/libnet-arp-perl/get_mac_bsd.c
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-arp-perl/get_mac_bsd.c?rev=36268&op=diff
==============================================================================
--- trunk/libnet-arp-perl/get_mac_bsd.c (original)
+++ trunk/libnet-arp-perl/get_mac_bsd.c Sun May 24 04:59:45 2009
@@ -30,20 +30,18 @@
#include <net/if_dl.h>
#include <net/if_types.h>
#include <net/ethernet.h>
+#include "arp.h"
-int get_mac_bsd(u_char *dev, char *mac)
+int get_mac_bsd(const char *dev, char *mac)
{
struct ifaddrs *iface, *iffirst;
- if(strlen(mac) > 0)
- strcpy(mac,"unknown");
- else
+ if ( (mac == NULL) || (dev == NULL) )
return -1;
- if(strlen(dev) == 0)
- return -1;
+ strncpy(mac,"unknown", HEX_HW_ADDR_LEN);
+ mac[HEX_HW_ADDR_LEN-1] = '\0';
- strcpy(mac,"unknown");
if (getifaddrs(&iface))
return -1;
Modified: trunk/libnet-arp-perl/get_mac_linux.c
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-arp-perl/get_mac_linux.c?rev=36268&op=diff
==============================================================================
--- trunk/libnet-arp-perl/get_mac_linux.c (original)
+++ trunk/libnet-arp-perl/get_mac_linux.c Sun May 24 04:59:45 2009
@@ -21,30 +21,29 @@
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
+#include <sys/types.h>
#include <sys/ioctl.h>
#include <net/ethernet.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
#include <net/if.h>
+#include "arp.h"
-int get_mac_linux(u_char *dev, char *mac)
+int get_mac_linux(const char *dev, char *mac)
{
- int sock;
+ int sock;
struct ifreq iface;
- struct sockaddr_in *addr;
- struct ether_addr ether;
-
- if(strlen(mac) > 0)
- strcpy(mac,"unknown");
- else
+
+ if ( (mac == NULL) || (dev == NULL) )
return -1;
- if(strlen(dev) == 0)
- return -1;
-
- strcpy(iface.ifr_name,dev);
-
+ /* Set hardware address as unknown */
+ strncpy(mac,"unknown", HEX_HW_ADDR_LEN);
+ mac[HEX_HW_ADDR_LEN-1] = '\0';
+
+ /* Copy device name into the ifreq strcture so that we can look for its
+ * hardware address through an ioctl request */
+ strncpy(iface.ifr_name, dev, IFNAMSIZ);
+ iface.ifr_name[IFNAMSIZ-1] = '\0';
+
// Open a socket
if((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
{
Modified: trunk/libnet-arp-perl/send_packet_bsd.c
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-arp-perl/send_packet_bsd.c?rev=36268&op=diff
==============================================================================
--- trunk/libnet-arp-perl/send_packet_bsd.c (original)
+++ trunk/libnet-arp-perl/send_packet_bsd.c Sun May 24 04:59:45 2009
@@ -26,7 +26,7 @@
#include <net/if.h>
#include "arp.h"
-int send_packet_bsd(u_char *dev, u_char *packet, u_int packetsize)
+int send_packet_bsd(const char *dev, u_char *packet, u_int packetsize)
{
int bpffd, i;
char bpfdev[12];
Modified: trunk/libnet-arp-perl/send_packet_linux.c
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-arp-perl/send_packet_linux.c?rev=36268&op=diff
==============================================================================
--- trunk/libnet-arp-perl/send_packet_linux.c (original)
+++ trunk/libnet-arp-perl/send_packet_linux.c Sun May 24 04:59:45 2009
@@ -20,16 +20,14 @@
#include <string.h>
#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
#include <arpa/inet.h>
-#include <unistd.h>
#include "arp.h"
-int send_packet_linux(u_char *dev, u_char *packet, u_int packetsize)
+int send_packet_linux(const char *dev, u_char *packet, u_int packetsize)
{
struct sockaddr addr;
int sock;
More information about the Pkg-perl-cvs-commits
mailing list