From 8d4946b3f451aec4547415ad09419ad90330b2bb Mon Sep 17 00:00:00 2001 From: Stefan Date: Thu, 15 Feb 2024 07:52:42 +0100 Subject: [PATCH 1/2] Fixed segv touch /tmp/xx grc65 /tmp/xx --- src/grc65/main.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/grc65/main.c b/src/grc65/main.c index 7d31bfc52..6b3ca04de 100644 --- a/src/grc65/main.c +++ b/src/grc65/main.c @@ -231,10 +231,11 @@ static int findToken (const char * const *tokenTbl, const char *token) /* takes as input table of tokens and token, returns position in table or -1 if not found */ int i; - for (i = 0; tokenTbl[i][0]; i++) { - if (strcmp (tokenTbl[i], token) == 0) { - return i; - } + if (token != NULL) { + for (i = 0; tokenTbl[i][0]; i++) { + if (strcmp (tokenTbl[i], token) == 0) { + return i; + } } return -1; From ab0eb4fe58450649c698ebead914a97069dfbe7f Mon Sep 17 00:00:00 2001 From: Stefan Date: Thu, 15 Feb 2024 09:03:46 +0100 Subject: [PATCH 2/2] oops --- src/grc65/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/grc65/main.c b/src/grc65/main.c index 6b3ca04de..5ef9e9645 100644 --- a/src/grc65/main.c +++ b/src/grc65/main.c @@ -236,6 +236,7 @@ static int findToken (const char * const *tokenTbl, const char *token) if (strcmp (tokenTbl[i], token) == 0) { return i; } + } } return -1;