diff options
author | Steven Murdoch <Steven.Murdoch@cl.cam.ac.uk> | 2010-10-04 14:14:11 +0100 |
---|---|---|
committer | Steven Murdoch <Steven.Murdoch@cl.cam.ac.uk> | 2010-10-04 14:31:27 +0100 |
commit | 5a77c648345fe0f7750c58e4d6aee96eff3e02fe (patch) | |
tree | e74634e96868d16183b677bd8cc1b4eb8aa3ef34 /src/test | |
parent | 80b515b85fdfbcd645cb1920e398b3f2f6e85a31 (diff) | |
download | tor-5a77c648345fe0f7750c58e4d6aee96eff3e02fe.tar.gz tor-5a77c648345fe0f7750c58e4d6aee96eff3e02fe.zip |
Fix issues in nickm's review of format_helper_exit_status for bug #1903
- Responsibility of clearing hex_errno is no longer with caller
- More conservative bounds checking
- Length requirement of hex_errno documented
- Output format documented
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test_util.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/test/test_util.c b/src/test/test_util.c index 68a0ca2984..208c5c4f59 100644 --- a/src/test/test_util.c +++ b/src/test/test_util.c @@ -1212,14 +1212,13 @@ test_util_load_win_lib(void *ptr) static void clear_hex_errno(char *hex_errno) { - memset(hex_errno, ' ', HEX_ERRNO_SIZE - 2); - hex_errno[HEX_ERRNO_SIZE - 1] = '\n'; - hex_errno[HEX_ERRNO_SIZE] = '\0'; + memset(hex_errno, '\0', HEX_ERRNO_SIZE + 1); } static void test_util_exit_status(void *ptr) { + /* Leave an extra byte for a \0 so we can do string comparison */ char hex_errno[HEX_ERRNO_SIZE + 1]; (void)ptr; |