better to just use stb_strncpy inside stb__splitpath_raw, also fixed an indexing bug in stb_strncpy itself.

This commit is contained in:
Brian Collins 2020-01-19 14:38:09 -08:00
parent 7c44b15903
commit 8fca192660

5
stb.h
View File

@ -2009,7 +2009,7 @@ char *stb_trimwhite(char *s)
char *stb_strncpy(char *s, char *t, int n)
{
stb_p_strncpy_s(s,n+1,t,n);
s[n-1] = 0;
s[n] = 0;
return s;
}
@ -2457,8 +2457,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, y-x+1, path+x, y-x);
buffer[y-x] = 0;
stb_strncpy(buffer, path+x, y-x);
return buffer;
}