bool tcppacket_h(connection_t *c, const char *request) {
short int len;
- if(sscanf(request, "%*d %hd", &len) != 1) {
+ if(sscanf(request, "%*d %hd", &len) != 1 || len < 0) {
logger(DEBUG_ALWAYS, LOG_ERR, "Got bad %s from %s (%s)", "PACKET", c->name,
c->hostname);
return false;
bool sptps_tcppacket_h(connection_t *c, const char *request) {
short int len;
- if(sscanf(request, "%*d %hd", &len) != 1) {
+ if(sscanf(request, "%*d %hd", &len) != 1 || len < 0) {
logger(DEBUG_ALWAYS, LOG_ERR, "Got bad %s from %s (%s)", "SPTPS_PACKET", c->name,
c->hostname);
return false;