mirror of
git://git.yoctoproject.org/poky
synced 2026-11-02 06:20:44 +00:00
The bug was introduced by upstream commit [1] where strncat was replaced with internal my_strncat function, such as: char dest[32] = "/sys/devices/platform/axi"; my_strncat(dest, "/", sizeof(dest) - strlen(dest) - 1); Will result in dest string being: /sys/ and not the expected: /sys/devices/platform/axi/ The meaning of the "len" parameter in the my_strncat function is the size limit for copying characters from "from", not the size limit for "to" after copying. Also, the "#define safestrcat(to, from) my_strncat(to, from, sizeof(to) - strlen(to) - 1)" has already imposed a limit on max based on the size of "to". Modify the function to prevent truncation of content when too many bytes are passed to the my_strcat function. [1] https://github.com/linux-ras/sysfsutils/commit/0719881cad85f837f039ecb378b823306640902a (From OE-Core rev: a5d2a5ce94b82957e2a9336c18dce9b28073cd71) Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>