wm: teppich

Download patch

ref: 2991ff4445fcb7a4d160828acc89d848c31be09e
parent: 5c52ce22504688695f87ba4730990c51fa3cde56
author: mkf <mkf@cloud9p.org>
date: Sun Dec 3 15:52:59 EST 2023

envfs: add checks for length of files and file names

--- a/fs/envfs.c
+++ b/fs/envfs.c
@@ -90,6 +90,13 @@
 	if(envfs->state != READY)
 		envfs_init();
 
+	if(strlen(name) > NAME_MAX)
+		return NAME_TOO_LONG;
+
+	for(int i = 0 ; i < strlen(name) ; i++)
+		if(!isalpha(name[i]))
+			return INVALID_FILENAME;
+
 	f = envfs_create(name);
 	f->buf = malloc(strlen(buf));
 	strncpy(f->buf, buf, strlen(buf));