strncat is a pain to use because the last argument is the remaining space in the buffer, not the buffer size. sadly glibc doesn't have strlcat...
diff --git a/toys/other/mountpoint.c b/toys/other/mountpoint.c index 29b8ae6..6124129 100644 --- a/toys/other/mountpoint.c +++ b/toys/other/mountpoint.c @@ -43,7 +43,7 @@ void mountpoint_main(void) if (!quiet) printf("%s: not a directory\n", toybuf); return; } - strncat(toybuf, "/..", sizeof(toybuf)); + strncat(toybuf, "/..", sizeof(toybuf)-strlen(toybuf)-1); stat(toybuf, &st2); res = (st1.st_dev != st2.st_dev) || (st1.st_dev == st2.st_dev && st1.st_ino == st2.st_ino); _______________________________________________ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.net