[hackers] [libixp] Fix exit status and segfault in ixpc xwrite

From: Kris Maglione <jg_AT_suckless.org>
Date: Sat Feb 17 06:20:10 2007

changeset: 34:b68d726fb55c
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Sat Feb 17 00:19:24 2007 -0500
summary: Fix exit status and segfault in ixpc xwrite

diff -r 315648ab550d -r b68d726fb55c ixpc.c
--- a/ixpc.c Fri Feb 16 02:34:21 2007 -0500
+++ b/ixpc.c Sat Feb 17 00:19:24 2007 -0500
@@ -281,13 +281,14 @@ main(int argc, char *argv[]) {
         else if(!strncmp(cmd, "write", 6))
                 ret = xwrite(file, IXP_OWRITE);
         else if(!strncmp(cmd, "xwrite", 7)) {
- ixp_strlcat(buffer, argv[i++], 1023);
+ if(i < argc)
+ ixp_strlcat(buffer, argv[i++], 1023);
                 while(i < argc) {
                         ixp_strlcat(buffer, " ", 1024);
                         if(ixp_strlcat(buffer, argv[i++], 1024) > 1023)
                                 break;
                 }
- xawrite(file, IXP_OWRITE);
+ ret = xawrite(file, IXP_OWRITE);
         }else {
 Usage:
                 ixp_eprint("usage: ixpc [-a <address>] {create | read | ls [-l] | remove | write} <file>\n"
Received on Sat Feb 17 2007 - 06:20:10 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:55:24 UTC