Feature/comments and buffer checks (#73)

* Added comments

* Replaced Goto construct

* Added apdu_len check

* Added comments

* Added string limit and reworked printable check

* Mainly comments

* Just comments

* Just comments

* decode service request returns now non zero on success

* eliminated warnings

* Added character string init with length check.

* Paranoic length check

* Comments and object index checking on read/write.

* Check name/desc strings before returning.

* Eliminated Goto
This commit is contained in:
Roy Schneider
2020-04-16 17:38:49 +02:00
committed by GitHub
parent 1ead6acea5
commit 8f13d59629
16 changed files with 987 additions and 360 deletions
+5 -3
View File
@@ -422,7 +422,9 @@ static int get_local_ifr_ioctl(char *ifname, struct ifreq *ifr, int request)
int fd;
int rv; /* return value */
strncpy(ifr->ifr_name, ifname, sizeof(ifr->ifr_name));
strncpy(ifr->ifr_name, ifname, sizeof(ifr->ifr_name) - 1);
ifr->ifr_name[sizeof(ifr->ifr_name) - 1] = 0;
fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
if (fd < 0) {
rv = fd;
@@ -443,7 +445,7 @@ static int get_local_ifr_ioctl(char *ifname, struct ifreq *ifr, int request)
*/
int bip_get_local_address_ioctl(char *ifname, struct in_addr *addr, int request)
{
struct ifreq ifr = { { { 0 } } };
struct ifreq ifr = { {{0}}, {{0}} };
struct sockaddr_in *tcpip_address;
int rv; /* return value */
@@ -535,7 +537,7 @@ bool bip_init(char *ifname)
struct sockaddr_in sin;
int sockopt = 0;
int sock_fd = -1;
char *ifname_default = "eth0";
static char *ifname_default = "eth0";
if (ifname) {
bip_set_interface(ifname);