aboutsummaryrefslogtreecommitdiffstats
path: root/libglouglou/utils.c
diff options
context:
space:
mode:
authorLaurent Ghigonis <laurent@p1sec.com>2013-07-08 19:32:56 +0200
committerLaurent Ghigonis <laurent@p1sec.com>2013-07-08 19:32:56 +0200
commita3b2d502b95700cdff38d3a3eafd28d32e39f402 (patch)
tree20c356a6ec6f42337ec3e2620d417cfe38d827ef /libglouglou/utils.c
parentcompile gg_map gg_sniff and libglouglou with -O0 -g (diff)
downloadglouglou-a3b2d502b95700cdff38d3a3eafd28d32e39f402.tar.xz
glouglou-a3b2d502b95700cdff38d3a3eafd28d32e39f402.zip
fix segfault because of bad libdnet intf_get_dst() usage
shame on libdnet for this shitty interface !
Diffstat (limited to '')
-rw-r--r--libglouglou/utils.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/libglouglou/utils.c b/libglouglou/utils.c
index 050a753..f842857 100644
--- a/libglouglou/utils.c
+++ b/libglouglou/utils.c
@@ -203,15 +203,21 @@ droppriv(char *user, int do_chroot, char *chroot_path)
char *
get_iface(char *ip) {
struct addr dst;
- struct intf_entry entry;
+ char buf[1024];
+ struct intf_entry *entry;
intf_t *intf;
+ entry = (struct intf_entry *)buf;
+ memset(entry, 0, sizeof(*entry));
+ entry->intf_len = sizeof(buf);
intf = intf_open();
addr_aton(ip, &dst);
- if (intf_get_dst(intf, &entry, &dst) < 0)
+ if (intf_get_dst(intf, entry, &dst) < 0)
return NULL;
intf_close(intf);
- return strdup(entry.intf_name);
+ printf("XXX get_iface %s: %s\n", ip, entry->intf_name);
+
+ return strdup(entry->intf_name);
}