diff --git a/stb.h b/stb.h index 9127d5c..db53907 100644 --- a/stb.h +++ b/stb.h @@ -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; }