From: Simon Wilkinson Date: Sat, 2 Mar 2013 12:21:06 +0000 (+0000) Subject: aklog: Fix buffer overflows in next_path X-Git-Tag: upstream/1.6.10_pre1^2~130 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=2c3b0c239285b2f503c5c745648a710cb84af130;p=packages%2Fo%2Fopenafs.git aklog: Fix buffer overflows in next_path Use strlcpy and strlcat Caught by coverity (#985765) Reviewed-on: http://gerrit.openafs.org/9447 Reviewed-by: Derrick Brashear Tested-by: BuildBot Reviewed-by: Jeffrey Altman (cherry picked from commit f4373e7867abd50b3fe39716073811794fe62379) Change-Id: I45d3be18e2975443ce2135f4057128e51d995fa2 Reviewed-on: http://gerrit.openafs.org/11061 Tested-by: BuildBot Reviewed-by: Chas Williams - CONTRACTOR Reviewed-by: Andrew Deason Reviewed-by: Stephan Wiesand --- diff --git a/src/aklog/aklog.c b/src/aklog/aklog.c index 056713a23..deb2a42e5 100644 --- a/src/aklog/aklog.c +++ b/src/aklog/aklog.c @@ -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,