]> Sergey Matveev's repositories - nnn.git/commitdiff
Fix strlcpy() size argument
authorsin <sin@2f30.org>
Fri, 19 Feb 2016 13:40:44 +0000 (13:40 +0000)
committersin <sin@2f30.org>
Fri, 19 Feb 2016 13:40:44 +0000 (13:40 +0000)
It should be the size of the destination buffer, not the source.

In this case, both src and dest have the same size.

noice.c

diff --git a/noice.c b/noice.c
index 4d032d37f238a0e4d1f3d6a59a321af234c4849a..6b04d4e01c91c64568bc3d11f4dbf1f39b0c2e75 100644 (file)
--- a/noice.c
+++ b/noice.c
@@ -598,7 +598,7 @@ nochange:
                                goto nochange;
                        }
                        /* Save history */
-                       strlcpy(oldpath, path, sizeof(path));
+                       strlcpy(oldpath, path, sizeof(oldpath));
                        strlcpy(path, dir, sizeof(path));
                        /* Reset filter */
                        strlcpy(fltr, ifilter, sizeof(fltr));