]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
aklog: Fix buffer overflows in next_path
authorSimon Wilkinson <sxw@your-file-system.com>
Sat, 2 Mar 2013 12:21:06 +0000 (12:21 +0000)
committerStephan Wiesand <stephan.wiesand@desy.de>
Tue, 3 Jun 2014 16:55:34 +0000 (12:55 -0400)
Use strlcpy and strlcat

Caught by coverity (#985765)

Reviewed-on: http://gerrit.openafs.org/9447
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
(cherry picked from commit f4373e7867abd50b3fe39716073811794fe62379)

Change-Id: I45d3be18e2975443ce2135f4057128e51d995fa2
Reviewed-on: http://gerrit.openafs.org/11061
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
src/aklog/aklog.c

index 056713a2384a820a7e81d2825027003d0f3e434e..deb2a42e5d78aa4652e50e27fd9c568c5f0fb8cc 100644 (file)
@@ -1191,7 +1191,7 @@ next_path(char *origpath)
     if (origpath) {
        memset(path, 0, sizeof(path));
        memset(pathtocheck, 0, sizeof(pathtocheck));
-       strcpy(path, origpath);
+       strlcpy(path, origpath, sizeof(path));
        last_comp = path;
        symlinkcount = 0;
        return(NULL);
@@ -1222,7 +1222,7 @@ next_path(char *origpath)
 
            memset(tmpbuf, 0, sizeof(tmpbuf));
            if (elast_comp)
-               strcpy(tmpbuf, elast_comp);
+               strlcpy(tmpbuf, elast_comp, sizeof(tmpbuf));
            if (linkbuf[0] == DIR) {
                /*
                 * If this is a symbolic link to an absolute path,