changed buffer to path for STB_EXT_NO_PERIOD, and specified appropriate buffer size for the copy (sizeof(buffer) referred to the size of the buffer pointer, which was incorrect)

This commit is contained in:
Brian Collins 2020-01-19 13:06:11 -08:00
parent f67165c2bb
commit 41d1dcc029

4
stb.h
View File

@ -2439,7 +2439,7 @@ static char *stb__splitpath_raw(char *buffer, char *path, int flag)
} else {
x = f2;
if (flag & STB_EXT_NO_PERIOD)
if (buffer[x] == '.')
if (path[x] == '.')
++x;
}
@ -2456,7 +2456,7 @@ static char *stb__splitpath_raw(char *buffer, char *path, int flag)
}
if (len) { stb_p_strcpy_s(buffer, sizeof(buffer), "./"); return buffer; }
stb_p_strncpy_s(buffer, sizeof(buffer),path+x, y-x);
stb_p_strncpy_s(buffer, y-x+1, path+x, y-x);
buffer[y-x] = 0;
return buffer;
}