diff options
| author | Bryce Harrington <b.harrington@samsung.com> | 2014-06-06 19:17:48 -0700 |
|---|---|---|
| committer | Bryce Harrington <b.harrington@samsung.com> | 2014-06-12 13:51:36 -0700 |
| commit | 97264131b08ab28a514cfb9a77a161091914e4b9 (patch) | |
| tree | 43acd9ee4a3702ce670456af1763d961d7572b79 /src/caskbench.cpp | |
| parent | eab0fa01a9bfd1d84b445a2f03c44aaa881f3146 (diff) | |
caskbench: Fix bounds checking on string variables
Since we're going to concatenate two strings, it's not enough to simply
check the length of the second string. If it were of length
MAX_BUFFER-1, then the check would pass but concatenating it with
"cairo-" would then result in a MAX_BUFFER+5 length string which would
be out of bounds.
Diffstat (limited to 'src/caskbench.cpp')
| -rw-r--r-- | src/caskbench.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/caskbench.cpp b/src/caskbench.cpp index 4f7b191..4081113 100644 --- a/src/caskbench.cpp +++ b/src/caskbench.cpp @@ -442,7 +442,7 @@ void populate_user_tests (const char** tests, int& num_tests, int* test_ids) if (tests == NULL) return; while (tests[i] != NULL) { - if (strlen(tests[i]) >= MAX_BUFFER) + if (strlen(tests[i])+6 >= MAX_BUFFER) errx (0, "Invalid test case: test name is too long\n"); #ifdef USE_CAIRO |