diff options
| author | Greg Hudson <ghudson@mit.edu> | 2011-10-18 16:32:28 +0000 |
|---|---|---|
| committer | Greg Hudson <ghudson@mit.edu> | 2011-10-18 16:32:28 +0000 |
| commit | ddea50b5a7e04a28e2a15b2989125ccc4532ccf6 (patch) | |
| tree | 35f8c11b561f35a0b8bcbc54190a440cfdaa4ef9 /src/include | |
| parent | cb6d42ecaf62749f661d9f7f0c647bcaa4118eda (diff) | |
| download | krb5-ddea50b5a7e04a28e2a15b2989125ccc4532ccf6.tar.gz krb5-ddea50b5a7e04a28e2a15b2989125ccc4532ccf6.tar.xz krb5-ddea50b5a7e04a28e2a15b2989125ccc4532ccf6.zip | |
Ensure termination in Windows vsnprintf wrapper
The Windows _vsnprintf does not terminate its output buffer in the
overflow case. Make sure we do that in the wrapper. Reported by
Chris Hecker.
(Not an issue for KfW 3.2 since we weren't using snprintf in 1.6.x
except in Unix-specific code.)
ticket: 6980
target_version: 1.10
tags: pullup
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25367 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/k5-platform.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/include/k5-platform.h b/src/include/k5-platform.h index 77d710b49..d1896e7f8 100644 --- a/src/include/k5-platform.h +++ b/src/include/k5-platform.h @@ -958,8 +958,10 @@ vsnprintf(char *str, size_t size, const char *format, va_list args) va_copy(args_copy, args); length = _vscprintf(format, args_copy); va_end(args_copy); - if (size) + if (size > 0) { _vsnprintf(str, size, format, args); + str[size - 1] = '\0'; + } return length; } static inline int |
