Index: packetbl.c ================================================================== --- packetbl.c +++ packetbl.c @@ -1369,10 +1369,11 @@ */ int check_packet_list(const struct packet_info *ip, struct config_entry *list) { struct config_entry *wltmp = NULL; unsigned int ip_proc; + int rv; if (ip == NULL || list == NULL) { return 0; } @@ -1388,13 +1389,19 @@ p = ip_proc; p &= wltmp->cidr.processed; if (p == wltmp->cidr.ip) { - snprintf(msgbuf, sizeof(msgbuf), "%hhu.%hhu.%hhu.%hhu %x/%d", - ip->b1, ip->b2, ip->b3, ip->b4, - wltmp->cidr.ip, wltmp->cidr.network); + rv = snprintf(msgbuf, sizeof(msgbuf), + "%hhu.%hhu.%hhu.%hhu %x/%d", + ip->b1, ip->b2, ip->b3, ip->b4, + wltmp->cidr.ip, wltmp->cidr.network); + if (rv < 0) { + syslog(LOG_ERR, "snprintf failed at line %d: %s", + __LINE__, strerror(errno)); + exit (1); + } return 1; } if (wltmp->next == NULL) { break; @@ -1424,18 +1431,30 @@ * It must be able to cope with "ip" being NULL. * */ static void get_ip_string(const struct packet_info *ip) { + int rv; + if (ip == NULL) { - sprintf(msgbuf, "-"); + rv = sprintf(msgbuf, "-"); + if (rv < 0) { + syslog(LOG_ERR, "sprintf failed in line %d: %s", + __LINE__, strerror(errno)); + exit(1); + } return; } - snprintf(msgbuf, sizeof(msgbuf), "%hhu.%hhu.%hhu.%hhu:%d.%d", ip->b1, - ip->b2, ip->b3, ip->b4, - ip->s_port,ip->d_port); + rv = snprintf(msgbuf, sizeof(msgbuf), "%hhu.%hhu.%hhu.%hhu:%d.%d", + ip->b1, ip->b2, ip->b3, ip->b4, + ip->s_port,ip->d_port); + if (rv < 0) { + syslog(LOG_ERR, "snprintf failed in line %d: %s", + __LINE__, strerror(errno)); + exit(1); + } return; } #ifdef USE_SOCKSTAT /*