Compare commits

...

2 Commits

Author SHA1 Message Date
da826d7ae9 prevent change[] over indexing 2023-09-03 00:19:01 +02:00
aa2a1444d8 style fix 2023-09-03 00:18:22 +02:00
2 changed files with 2 additions and 3 deletions

View File

@ -499,7 +499,7 @@ static bool issrcfile(char *path) {
bool looks_like_source = false; bool looks_like_source = false;
/* ensure there is some file suffix */ /* ensure there is some file suffix */
if(s == NULL || *++s == '\0') return false; if(s == NULL || *(++s) == '\0') { return false; }
/* if an SCCS or versioned file */ /* if an SCCS or versioned file */
if(file[1] == '.' && file + 2 != s) { /* 1 character prefix */ if(file[1] == '.' && file + 2 != s) { /* 1 character prefix */

View File

@ -248,7 +248,6 @@ static int global_input(const int c) {
} }
break; break;
case '+': case '+':
case ctrl('L'):
case KEY_NPAGE: case KEY_NPAGE:
if(totallines == 0) { return 0; } /* don't redisplay if there are no lines */ if(totallines == 0) { return 0; } /* don't redisplay if there are no lines */
curdispline = 0; curdispline = 0;
@ -386,7 +385,7 @@ int change_input(const int c) {
{ {
/* if a line was selected */ /* if a line was selected */
const int cc = dispchar2int(c); const int cc = dispchar2int(c);
if(cc != -1) { if(cc != -1 && cc < totallines) {
change[cc] = !change[cc]; change[cc] = !change[cc];
window_change |= CH_RESULT; window_change |= CH_RESULT;
} }