1
0
mirror of https://github.com/lwip-tcpip/lwip.git synced 2025-03-15 04:20:51 +00:00

makefsdata: fix buffer corruption with very long paths

See bug 
This commit is contained in:
Simon Goldschmidt 2023-11-29 22:03:46 +01:00
parent ee1523630a
commit b413b04093

@ -895,6 +895,10 @@ static int is_ssi_file(const char *filename)
/* build up the relative path to this file */
size_t sublen = strlen(curSubdir);
size_t freelen = sizeof(curSubdir) - sublen - 1;
if (sublen + strlen(filename) + 1 >= sizeof(curSubdir)) {
/* prevent buffer overflow */
return 0;
}
strncat(curSubdir, "/", freelen);
strncat(curSubdir, filename, freelen - 1);
curSubdir[sizeof(curSubdir) - 1] = 0;