fix: construct Plan 9 paths without truncation
This commit is contained in:
9
strans.c
9
strans.c
@@ -860,15 +860,16 @@ mapget(Trie *t, Str *key, Str *out)
|
||||
void
|
||||
mapinit(char *dir)
|
||||
{
|
||||
char path[1024];
|
||||
char *path;
|
||||
int i;
|
||||
|
||||
for(i = 0; i < nelem(langs); i++){
|
||||
if(langs[i].mapname == nil)
|
||||
continue;
|
||||
if(snprint(path, sizeof(path), "%s/%s.map", dir,
|
||||
langs[i].mapname) >= (int)sizeof path)
|
||||
die("map path too long: %s/%s.map", dir, langs[i].mapname);
|
||||
path = smprint("%s/%s.map", dir, langs[i].mapname);
|
||||
if(path == nil)
|
||||
die("out of memory");
|
||||
langs[i].map = trieopen(path);
|
||||
free(path);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user