poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Don't crash on incomplete dot commands


From: John Darrington
Subject: [PATCH] Don't crash on incomplete dot commands
Date: Tue, 24 Dec 2019 09:09:51 +0100

---
 ChangeLog    | 5 +++++
 src/pk-cmd.c | 3 +--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1cb70f5..ed2960a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2019-12-22 John Darrington <address@hidden>
 
+       * src/pk-cmd.c (pk_cmd_exec_1): Properly initialise argc
+       instead of relying on subsequent assignment.
+
+2019-12-22 John Darrington <address@hidden>
+
        * src/ios-dev-file.c (ios_dev_file_open): Use a more reliable
        method to determine the file's mode.
        (ios_dev_file_get_mode): New function.
diff --git a/src/pk-cmd.c b/src/pk-cmd.c
index 3de2851..2413c2a 100644
--- a/src/pk-cmd.c
+++ b/src/pk-cmd.c
@@ -257,7 +257,7 @@ pk_cmd_exec_1 (char *str, struct pk_trie *cmds_trie, char 
*prefix)
   size_t i;
   char cmd_name[MAX_CMD_NAME], *p;
   struct pk_cmd *cmd;
-  int argc;
+  int argc = 0;
   struct pk_cmd_arg argv[8];
   uint64_t uflags;
   const char *a;
@@ -327,7 +327,6 @@ pk_cmd_exec_1 (char *str, struct pk_trie *cmds_trie, char 
*prefix)
     }
 
   /* Parse arguments.  */
-  argc = 0;
   a = cmd->arg_fmt;
   while (*a != '\0')
     {
-- 
2.11.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]