mqttClient-for-Legato not building

Hi,

I have been using the mqttClient-for-Legato library for a couple of days now, and I faced an error while building the legato app providing the MQTT API:

/home/xxxxxxxx/mqttClientApi/mqttClientApiComponent/mbedtls/library/x509_crt.c:1173:62: error: '%s' directive output may be truncated writing up to 255 bytes into a region of size 254 [-Werror=format-truncation=]
         mbedtls_snprintf( entry_name, sizeof entry_name, "%s/%s", path, entry->d_name );
                                                              ^~
In file included from /home/xxxxxxxx/mqttClientApi/mqttClientApiComponent/mbedtls/library/x509_crt.c:51:0:
/home/xxxxxxxx/mqttClientApi/mqttClientApiComponent/mbedtls/include/mbedtls/platform.h:184:28: note: 'snprintf' output 2 or more bytes (assuming 257) into a destination of size 255
 #define mbedtls_snprintf   snprintf
/home/xxxxxxxx/mqttClientApi/mqttClientApiComponent/mbedtls/library/x509_crt.c:1173:9: note: in expansion of macro 'mbedtls_snprintf'
         mbedtls_snprintf( entry_name, sizeof entry_name, "%s/%s", path, entry->d_name );
         ^~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

which corresponds to this part of the code.

The sizes indeed do not fit, comparing the entry_name size here hard-coded, and the size of entry->d_name from the dirent struct.
As a workaround, I had to extend the size of entry_name up to 257.

Now, this part of the code has been updated on the official mbedtls project (both in the latest release—2.16—and in the release used in this mqttClient-for-Legato repo—2.9) so integrating mbedtls updates should fix the issue. I have not tried yet (few details in the interface have changed with the updates, and the legato component’s includes should also change), and for now simply been using my workaround.

@noeltaillardat, What you use it’s not the official mqttClient supported by LEGATO, you need to refer to: Search · mqtt · GitHub