mirror of
https://git.openafs.org/openafs.git
synced 2025-01-18 23:10:58 +00:00
Windows: Secure C String usage in src\WINNT\afsd\fs.c
The use of strlen, strcat, strcpy, strncpy and sprintf in src\WINNT\afsd\fs.c does not effectively protect against buffer overruns and string truncation errors. This patchset replaces their use with StringCbLen, StringCbCat, StringCbCopy, StringCbCopyN, StringCbCopyEx and StringCbPrintf respectively from strsafe.h. The functions sscanf, fscanf and scanf do not check for the size of the parameters so it is prone to buffer overruns. These functions can be replaced by sscanf_s, fscanf_s, scanf_s when the Visual Studio compiler version is 1400 or greater. Also memcpy will be replaced by memcpy_s which will check for the size of the destination buffer. In all cases, failure conditions are handled. Patchset development was mentored by Asanka Herath and Jeffrey Altman. Change-Id: I01e9dfc616641c220b57d2871e3e140406df3653 Reviewed-on: http://gerrit.openafs.org/1736 Tested-by: Jeffrey Altman <jaltman@openafs.org> Reviewed-by: Tharidu Fernando <tharidufernando@gmail.com> Tested-by: Tharidu Fernando <tharidufernando@gmail.com> Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
This commit is contained in:
parent
fb50f2478c
commit
1e69ec9cfe