Message ID | 1424104995-18327-2-git-send-email-mike.holmes@linaro.org |
---|---|
State | Accepted |
Commit | 408ec8ab63aa99cbb9d711c45f2035f00aba7784 |
Headers | show |
Reviewed-by: Maxim Uvarov <maxim.uvarov@linaro.org> On 02/16/2015 07:43 PM, Mike Holmes wrote: > Calling strncpy with a maximum size argument of 128 bytes on destination > array "version_string" of size 128 bytes might leave the destination > string unterminated. > > Fixes https://bugs.linaro.org/show_bug.cgi?id=1207 > > Signed-off-by: Mike Holmes <mike.holmes@linaro.org> > --- > test/validation/odp_system.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/test/validation/odp_system.c b/test/validation/odp_system.c > index 65f857a..94ee712 100644 > --- a/test/validation/odp_system.c > +++ b/test/validation/odp_system.c > @@ -15,7 +15,8 @@ static void test_odp_version_numbers(void) > char version_string[128]; > char *s = version_string; > > - strncpy(version_string, odp_version_api_str(), sizeof(version_string)); > + strncpy(version_string, odp_version_api_str(), > + sizeof(version_string)-1); > > while (*s) { > if (isdigit(*s) || (strncmp(s, ".", 1) == 0)) {
diff --git a/test/validation/odp_system.c b/test/validation/odp_system.c index 65f857a..94ee712 100644 --- a/test/validation/odp_system.c +++ b/test/validation/odp_system.c @@ -15,7 +15,8 @@ static void test_odp_version_numbers(void) char version_string[128]; char *s = version_string; - strncpy(version_string, odp_version_api_str(), sizeof(version_string)); + strncpy(version_string, odp_version_api_str(), + sizeof(version_string)-1); while (*s) { if (isdigit(*s) || (strncmp(s, ".", 1) == 0)) {
Calling strncpy with a maximum size argument of 128 bytes on destination array "version_string" of size 128 bytes might leave the destination string unterminated. Fixes https://bugs.linaro.org/show_bug.cgi?id=1207 Signed-off-by: Mike Holmes <mike.holmes@linaro.org> --- test/validation/odp_system.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)