From a4459c817b6fca8c3197c2e852b6e33668fbb9ff Mon Sep 17 00:00:00 2001 From: Luca Deri Date: Fri, 6 Jun 2025 18:47:57 +0200 Subject: Compilation fix on old platforms --- src/lib/ndpi_main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/lib/ndpi_main.c') diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index f67bf5a65..61e2a257e 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -10986,6 +10986,8 @@ char *ndpi_get_proto_breed_name(ndpi_protocol_breed_t breed_id) { } ndpi_protocol_breed_t ndpi_get_breed_by_name(const char *name) { + int i; + if(!name) return(NDPI_PROTOCOL_UNRATED); @@ -10994,9 +10996,10 @@ ndpi_protocol_breed_t ndpi_get_breed_by_name(const char *name) { /* Cache the lowercased first character of 'name' */ const unsigned char fc = tolower((unsigned char)*name); - - for(int i = NDPI_PROTOCOL_SAFE; i <= NDPI_PROTOCOL_UNRATED; i++) { + + for(i = NDPI_PROTOCOL_SAFE; i <= NDPI_PROTOCOL_UNRATED; i++) { char *breed_name = ndpi_get_proto_breed_name((ndpi_protocol_breed_t)i); + if(breed_name && tolower((unsigned char)*breed_name) == fc) { if(strcasecmp(breed_name + 1, name + 1) == 0) return((ndpi_protocol_breed_t)i); -- cgit v1.2.3