diff options
| author | Zach DeCook <zachdecook@librem.one> | 2023-10-24 17:51:51 -0400 |
|---|---|---|
| committer | Zach DeCook <zachdecook@librem.one> | 2023-10-24 17:51:51 -0400 |
| commit | 4073009d199cf6b05f7ce92b904c8ffc260eb6c7 (patch) | |
| tree | 0fcf3565109e3572b17f110163c7511c388426bc /mapScore.c | |
| parent | 1811353d5eb14cadceaebc0b453ebc0691d8a500 (diff) | |
| download | swipeGuess-4073009d199cf6b05f7ce92b904c8ffc260eb6c7.tar.gz | |
mapScore: Fix segmentation fault
Diffstat (limited to 'mapScore.c')
| -rw-r--r-- | mapScore.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/mapScore.c b/mapScore.c index 9c40795..1135c2b 100644 --- a/mapScore.c +++ b/mapScore.c @@ -20,7 +20,7 @@ void makeMap(FILE *f) { map[c][1] = y; map[c][2] = 1; c = toupper(c); - if (map[toupper(c)][2] == 0) goto explicit_label; + if (c < 256 && map[c][2] == 0) goto explicit_label; break; } } @@ -33,8 +33,8 @@ int scoreWord(char *word, int (*fun)(int*,int*)) { for (c++;*c;c++) { if (*c == '\n') break; // pass over ignore unset chars. - if(map[(unsigned)*c][3] == 0) continue; - score += (*fun)(map[(unsigned)*p],map[(unsigned)*c]); + if(map[(unsigned char)*c][3] == 0) continue; + score += (*fun)(map[(unsigned char)*p],map[(unsigned char)*c]); p=c; } return score; |
