mirror of
https://git.sr.ht/~sircmpwn/gmnisrv
synced 2025-01-03 14:57:39 -05:00
serve: fix gcc-9.3.0 error in serve_autoindex
gcc 9.3.0 catches an off-by-one error with strncat in serve_autoindex where it might not write a 0 byte: In function ‘strncat’, inlined from ‘serve_autoindex’ at src/serve.c:60:3: /nix/store/...glibc-2.31-dev/include/bits/string_fortified.h:136:10: error: ‘__builtin___strncat_chk’ specified bound 4097 equals destination size [-Werror=stringop-overflow=] Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
parent
9d17ce46b0
commit
e77f354ca3
@ -57,7 +57,7 @@ serve_autoindex(struct gmnisrv_client *client, const char *path)
|
||||
while ((ent = readdir(dirp)) != NULL) {
|
||||
char fpath[PATH_MAX + 1];
|
||||
strcpy(fpath, path);
|
||||
strncat(fpath, ent->d_name, sizeof(fpath));
|
||||
strncat(fpath, ent->d_name, sizeof(fpath)-1);
|
||||
|
||||
struct stat st;
|
||||
if (stat(fpath, &st) != 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user