summaryrefslogtreecommitdiff
path: root/sys/src/cmd/8l/list.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2015-02-17 22:13:35 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2015-02-17 22:13:35 +0100
commit03feba8cc1a68da8882bfc90d182365308a00743 (patch)
tree7abec9fa0987ffd70ae30dffb7496d34d1d32241 /sys/src/cmd/8l/list.c
parentfdeea811b7f309e1bd542a0a23fd382e332b2c2e (diff)
[125678kqv][cl]: fix sprint() and strcpy() buffer overflows
Diffstat (limited to 'sys/src/cmd/8l/list.c')
-rw-r--r--sys/src/cmd/8l/list.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/sys/src/cmd/8l/list.c b/sys/src/cmd/8l/list.c
index f726a4e8c..212b8ad3c 100644
--- a/sys/src/cmd/8l/list.c
+++ b/sys/src/cmd/8l/list.c
@@ -55,7 +55,7 @@ Aconv(Fmt *fp)
int
Dconv(Fmt *fp)
{
- char str[STRINGSZ+40], s[20];
+ char str[STRINGSZ+40];
Adr *a;
int i;
@@ -130,10 +130,8 @@ Dconv(Fmt *fp)
goto conv;
}
brk:
- if(a->index != D_NONE) {
- snprint(s, sizeof(s), "(%R*%d)", a->index, a->scale);
- strcat(str, s);
- }
+ if(a->index != D_NONE)
+ return fmtprint(fp, "%s(%R*%d)", str, a->index, a->scale);
conv:
return fmtstrcpy(fp, str);
}