aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Slaven <bpk@hoopajoo.net>2005-11-22 16:53:09 (GMT)
committerSteve Slaven <bpk@hoopajoo.net>2005-11-22 16:53:09 (GMT)
commitdeb5745614e04b339d8bd5fce29ce9da7109e722 (patch)
tree3fd302697f665d2fcc7c2b2948427396c576d034
parent85afcb685fbcf5dbe52c3aaa46e07b68b8f378f9 (diff)
downloadpowwow-deb5745614e04b339d8bd5fce29ce9da7109e722.zip
powwow-deb5745614e04b339d8bd5fce29ce9da7109e722.tar.gz
powwow-deb5745614e04b339d8bd5fce29ce9da7109e722.tar.bz2
Fix for segfault when viewing a single alias from Kalev Lember
<kalev@smartlink.ee> #alias foo=bar #alias foo Caused segfault
-rw-r--r--cmd2.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/cmd2.c b/cmd2.c
index 06892ed..fda5694 100644
--- a/cmd2.c
+++ b/cmd2.c
@@ -216,10 +216,10 @@ void parse_alias __P1 (char *,str)
if (*np) {
char buf[BUFSIZE];
escape_specials(buf, left);
- sprintf(inserted_next, "#alias %s%.*s@%s=%.*s",
- BUFSIZE-9, buf,
- (*np)->group == NULL ? "*" : (*np)->group,
- BUFSIZE-(int)strlen(buf)-9, (*np)->subst);
+ snprintf(inserted_next, BUFSIZE, "#alias %s@%s=%s",
+ buf,
+ (*np)->group == NULL ? "*" : (*np)->group,
+ (*np)->subst);
} else {
PRINTF("#unknown alias, cannot show: \"%s\"\n", left);
}