]> Sergey Matveev's repositories - nnn.git/commitdiff
avoid doing arithmetic on void pointer
authorNRK <nrk@disroot.org>
Sat, 25 Dec 2021 04:37:53 +0000 (10:37 +0600)
committerNRK <nrk@disroot.org>
Sat, 25 Dec 2021 06:47:24 +0000 (12:47 +0600)
src/nnn.c

index ea753d078b2da3707db72e1530d8d70fc4b88cb3..5c7358cd1038d5959b701ae35062984e441febfe 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -7971,9 +7971,9 @@ static char *load_input(int fd, const char *path)
                ++chunk_count;
 
                while (off < total_read) {
-                       next = memchr(input + off, '\0', total_read - off) + 1;
-                       if (next == (void *)1)
+                       if ((next = memchr(input + off, '\0', total_read - off)) == NULL)
                                break;
+                       ++next;
 
                        if (next - input == off + 1) {
                                off = next - input;