ref: b4b4d2286bc0e7a4906bd00931b54b5d96099887
parent: bc5b85c37c2d966b6d65dededcfe4f9dd38eed9d
author: cinap_lenrek <[email protected]>
date: Sun Feb 24 23:18:30 EST 2019
aux/depend: fix %.*s format in path concatenation
--- a/sys/src/cmd/aux/depend.c
+++ b/sys/src/cmd/aux/depend.c
@@ -1379,7 +1379,9 @@
f->use++;
if(f->fd < 0){
name = strrchr(df->path, '/') + 1;
- n = snprint(path, sizeof path, "%.*s/%s", (int)(name-df->path), df->path, f->name);
+ n = snprint(path, sizeof path, "%.*s/%s",
+ utfnlen(df->path, name-df->path), df->path,
+ f->name);
if(n >= sizeof path - UTFmax){
syslog(0, dependlog, "path name too long: %.20s.../%.20s...", df->path, f->name);
return -1;