This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

[Bug report] azure_fota.c:is_update function returns a false negative

Hi, I was testing NCS v1.5.0 and Azure FOTA application and found a bug in the is_update() function

static bool is_update(void)
{	
	return strncmp(get_current_version(), fota_object.version,
		       strlen(get_current_version())) != 0;
}

If the current firmware version is shorter than the new one, it may return false even if the new firmware version is different.

Example, this function will return false for get_current_version() = "0.0.1" and fota_object.version = "0.0.11"

A possible fix is to change "n" parameter in strncmp to be the length of the larger string

Related