--- embedaddon/libnet/src/libnet_link_snit.c 2013/07/22 11:54:42 1.1.1.2 +++ embedaddon/libnet/src/libnet_link_snit.c 2023/09/27 11:11:38 1.1.1.3 @@ -1,5 +1,5 @@ /* - * $Id: libnet_link_snit.c,v 1.1.1.2 2013/07/22 11:54:42 misho Exp $ + * $Id: libnet_link_snit.c,v 1.1.1.3 2023/09/27 11:11:38 misho Exp $ * * libnet * libnet_snit.c - snit routines @@ -31,20 +31,13 @@ * This module now handles the STREAMS based NIT. */ -#if (HAVE_CONFIG_H) -#include "../include/config.h" -#endif -#if (!(_WIN32) || (__CYGWIN__)) -#include "../include/libnet.h" -#else -#include "../include/win32/libnet.h" -#endif +#include "common.h" + #include "../include/gnuc.h" #ifdef HAVE_OS_PROTO_H #include "../include/os-proto.h" #endif - struct libnet_link_int * libnet_open_link_interface(int8_t *device, int8_t *ebuf) { @@ -65,7 +58,8 @@ libnet_open_link_interface(int8_t *device, int8_t *ebu l->fd = open(dev, O_RDWR); if (l->fd < 0) { - sprintf(ebuf, "%s: %s", dev, strerror(errno)); + snprintf(ebuf, LIBNET_ERRBUF_SIZE, + "%s: %s", dev, strerror(errno)); goto bad; } @@ -74,12 +68,14 @@ libnet_open_link_interface(int8_t *device, int8_t *ebu */ if (ioctl(l->fd, I_SRDOPT, (int8_t *)RMSGD) < 0) { - sprintf(ebuf, "I_SRDOPT: %s", strerror(errno)); + snprintf(ebuf, LIBNET_ERRBUF_SIZE, + "I_SRDOPT: %s", strerror(errno)); goto bad; } if (ioctl(l->fd, I_PUSH, "nbuf") < 0) { - sprintf(ebuf, "push nbuf: %s", strerror(errno)); + snprintf(ebuf, LIBNET_ERRBUF_SIZE, + "push nbuf: %s", strerror(errno)); goto bad; } /* @@ -92,7 +88,8 @@ libnet_open_link_interface(int8_t *device, int8_t *ebu si.ic_dp = (int8_t *)𝔦 if (ioctl(l->fd, I_STR, (int8_t *)&si) < 0) { - sprintf(ebuf, "NIOCBIND: %s: %s", ifr.ifr_name, strerror(errno)); + snprintf(ebuf, LIBNET_ERRBUF_SIZE, + "NIOCBIND: %s: %s", ifr.ifr_name, strerror(errno)); goto bad; } @@ -147,3 +144,10 @@ libnet_write_link_layer(struct libnet_link_int *l, con } return (c); } + +/** + * Local Variables: + * indent-tabs-mode: nil + * c-file-style: "stroustrup" + * End: + */