umovestr result may have no NUL, use "%.*s" instead of "%s" to print it
* system.c (sys_mount): Be careful when printing umovestr result,
it may have no terminating NUL.
(sys_sysmips): Likewise.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
diff --git a/system.c b/system.c
index 8b7d6b3..58c4bd7 100644
--- a/system.c
+++ b/system.c
@@ -513,7 +513,7 @@
tcp->u_arg[0], sizeof type, type) < 0) {
tprintf("OLDTYPE:#%lx", tcp->u_arg[0]);
} else {
- tprintf("\"%s\", ", type);
+ tprintf("\"%.4s\", ", type);
}
printstr(tcp, tcp->u_arg[1], -1);
tprints(", ");
@@ -1437,11 +1437,11 @@
for all SVR4's? */
if (tcp->u_arg[2] & (MS_FSS | MS_DATA)) {
if (umovestr(tcp, tcp->u_arg[3], FSTYPSZ, fstyp) < 0) {
- *fstyp = 0;
+ fstyp[0] = '\0';
tprintf(", %ld", tcp->u_arg[3]);
}
else
- tprintf(", \"%s\"", fstyp);
+ tprintf(", \"%.*s\"", (int)FSTYPSZ, fstyp);
}
if (tcp->u_arg[2] & MS_DATA) {
tprints(", ");
@@ -2317,7 +2317,7 @@
if (umovestr(tcp, tcp->u_arg[1], (__NEW_UTS_LEN + 1), nodename) < 0)
tprintf(", %#lx", tcp->u_arg[1]);
else
- tprintf(", \"%s\"", nodename);
+ tprintf(", \"%.*s\"", (int)(__NEW_UTS_LEN + 1), nodename);
} else if (tcp->u_arg[0] == MIPS_ATOMIC_SET) {
tprintf(", %#lx, 0x%lx", tcp->u_arg[1], tcp->u_arg[2]);
} else if (tcp->u_arg[0] == MIPS_FIXADE) {