How to manage non null-terminated strings

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

How to manage non null-terminated strings

Giuseppe Modugno
Many times in the application payloads you have a message with non
null-terminated string, where the length of the string is in another
variable (derived from the length of the packet).

I think of MQTT messages that have strings. The callback parameters are
the pointer to the first char of string and the length of string.

Many times I need to compare the string against a fixed reference
string. However I can't use strncmp(), because it would success if the
string is shorter than the reference string.

I could copy the string in another array, but I think there's a better

lwip-users mailing list
[hidden email]