Sfoglia il codice sorgente

Fix check when char is unsigned (#665)

If char is unsigned (as on ARM) subtracting a larger number would
result in a wrap around, not a negative value.

  src/nnn.c: In function 'readpipe':
  src/nnn.c:4325:11: warning: comparison is always false due to limited
  range of data type [-Wtype-limits]

     if (ctx < 0 || ctx > CTX_MAX)
             ^
master
Sijmen J. Mulder GitHub 4 anni fa
parent
commit
235eb29614
Non sono state trovate chiavi note per questa firma nel database ID Chiave GPG: 4AEE18F83AFDEB23
1 ha cambiato i file con 3 aggiunte e 1 eliminazioni
  1. +3
    -1
      src/nnn.c

+ 3
- 1
src/nnn.c Vedi File

@@ -4326,9 +4326,11 @@ static void readpipe(int fd, char **path, char **lastname, char **lastdir)

if (g_buf[0] == '+')
ctx = (char)(get_free_ctx() + 1);
else if (g_buf[0] < '0')
return;
else {
ctx = g_buf[0] - '0';
if (ctx < 0 || ctx > CTX_MAX)
if (ctx > CTX_MAX)
return;
}



Loading…
Annulla
Salva