diff --git a/src/lib/protocols/thrift.c b/src/lib/protocols/thrift.c index 344795523df..49016608d5e 100644 --- a/src/lib/protocols/thrift.c +++ b/src/lib/protocols/thrift.c @@ -120,7 +120,7 @@ static void thrift_set_method(struct ndpi_detection_module_struct *ndpi_struct, ndpi_set_risk(ndpi_struct, flow, NDPI_INVALID_CHARACTERS, "Invalid method name"); flow->protos.thrift.method[0] = '\0'; } else { - strncpy(flow->protos.thrift.method, method, method_length); + strncpy(flow->protos.thrift.method, method, MIN(sizeof(flow->protos.thrift.method), method_length)); } }