commit 63903b9

lbr  ·  2026-02-08 07:46:46 +0000 UTC
parent 1c2e303
data: use lstat() instead of stat()

this disallows snac to serve a static file which is a symlink.
1 files changed,  +1, -1
M data.c
M data.c
+1, -1
1@@ -2668,7 +2668,7 @@ static int _load_raw_file(const char *fn, xs_val **data, int *size,
2                 struct stat sb;
3                 FILE *f;
4 
5-                if (stat(fn, &sb) == 0 && (sb.st_mode&S_IFMT) == S_IFREG) {
6+                if (lstat(fn, &sb) == 0 && (sb.st_mode&S_IFMT) == S_IFREG) {
7                     if ((f = fopen(fn, "rb")) != NULL) {
8                         *size = XS_ALL;
9                         *data = xs_read(f, size);