Skip to content

Commit b780538

Browse files
committed
Add NULL to the end of the match arrays
For whatever reason, making linenoise a library made most commands matches go out of bounds causing laco to crash. By adding these NULLs explicitly, this will insure -- hopefully -- that this wont happen.
1 parent e288621 commit b780538

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/commands.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
#include "util.h"
88
#include "commands/debugger.h"
99

10-
static const char* quit_matches[] = {"quit", "q"};
11-
static const char* help_matches[] = {"help", "?"};
10+
static const char* quit_matches[] = {"quit", "q", NULL};
11+
static const char* help_matches[] = {"help", "?", NULL};
1212

1313
/* Debugger commands */
14-
static const char* debug_info_matches[] = {"info"};
14+
static const char* debug_info_matches[] = {"info", NULL};
1515

1616
static void print_commands_help() {
1717
puts(" Commands available:\n");

src/flags.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ enum LacoFlags {
1010
LACO_VERSION
1111
};
1212

13-
static const char* version_matches[] = {"-v", "--version"};
14-
static const char* help_matches[] = {"-h", "-?", "--help"};
13+
static const char* version_matches[] = {"-v", "--version", NULL};
14+
static const char* help_matches[] = {"-h", "-?", "--help", NULL};
1515

1616
/* Check if the command flag is for version */
1717
static inline bool is_version(const char* arg) {

0 commit comments

Comments
 (0)