1
0
mirror of https://git.sr.ht/~sircmpwn/gmnisrv synced 2024-06-01 17:21:10 +00:00

autoindex: fix off-by-one buffer size

This commit is contained in:
Zach DeCook 2020-12-27 08:00:15 -05:00 committed by Drew DeVault
parent eac874b925
commit fbef1d34a1

View File

@ -96,6 +96,7 @@ serve_autoindex(struct gmnisrv_client *client, const char *path)
qsort(names, nameln, sizeof(names[0]), namecmp); qsort(names, nameln, sizeof(names[0]), namecmp);
bufsz++; // buffer needs to have room for the \0.
FILE *buf = fmemopen(NULL, bufsz, "w+"); FILE *buf = fmemopen(NULL, bufsz, "w+");
if (!buf) { if (!buf) {
goto internal_error; goto internal_error;