fix: construct Plan 9 paths without truncation

This commit is contained in:
2026-08-12 17:28:17 +09:00
parent 0d06ba43cd
commit a8a6c3b455
3 changed files with 15 additions and 12 deletions

10
dict.c
View File

@@ -99,16 +99,16 @@ dictopen(char *path)
void
dictinit(char *dir)
{
char path[1024];
char *path;
int i;
for(i = 0; i < nlang; i++){
if(langs[i].dictname == nil)
continue;
if(snprint(path, sizeof(path), "%s/%s.dict", dir,
langs[i].dictname) >= (int)sizeof path)
die("dictionary path too long: %s/%s.dict",
dir, langs[i].dictname);
path = smprint("%s/%s.dict", dir, langs[i].dictname);
if(path == nil)
die("out of memory");
langs[i].dict = dictopen(path);
free(path);
}
}