diff mbox

validation: system: copy model with snprintf

Message ID 1419457447-11360-1-git-send-email-mike.holmes@linaro.org
State Accepted
Headers show

Commit Message

Mike Holmes Dec. 24, 2014, 9:44 p.m. UTC
CID 85015:  Copy into fixed size buffer (STRING_OVERFLOW)

Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
---
 test/validation/odp_system.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Anders Roxell Jan. 5, 2015, 11:50 p.m. UTC | #1
On 2014-12-24 16:44, Mike Holmes wrote:
> CID 85015:  Copy into fixed size buffer (STRING_OVERFLOW)
> 
> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>

Reviewed-by: Anders Roxell <anders.roxell@linaro.org>

> ---
>  test/validation/odp_system.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/test/validation/odp_system.c b/test/validation/odp_system.c
> index 2afd4a7..b5742c4 100644
> --- a/test/validation/odp_system.c
> +++ b/test/validation/odp_system.c
> @@ -28,7 +28,7 @@ static void test_odp_sys_cpu_model_str(void)
>  {
>  	char model[128];
>  
> -	strcpy(model, odp_sys_cpu_model_str());
> +	snprintf(model, 128, "%s", odp_sys_cpu_model_str());
>  	CU_ASSERT(strlen(model) > 0);
>  	CU_ASSERT(strlen(model) < 127);
>  }
> -- 
> 2.1.0
> 
> 
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
Mike Holmes Jan. 6, 2015, 1:07 p.m. UTC | #2
Applied

On 5 January 2015 at 18:50, Anders Roxell <anders.roxell@linaro.org> wrote:

> On 2014-12-24 16:44, Mike Holmes wrote:
> > CID 85015:  Copy into fixed size buffer (STRING_OVERFLOW)
> >
> > Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
>
> Reviewed-by: Anders Roxell <anders.roxell@linaro.org>
>
> > ---
> >  test/validation/odp_system.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/test/validation/odp_system.c b/test/validation/odp_system.c
> > index 2afd4a7..b5742c4 100644
> > --- a/test/validation/odp_system.c
> > +++ b/test/validation/odp_system.c
> > @@ -28,7 +28,7 @@ static void test_odp_sys_cpu_model_str(void)
> >  {
> >       char model[128];
> >
> > -     strcpy(model, odp_sys_cpu_model_str());
> > +     snprintf(model, 128, "%s", odp_sys_cpu_model_str());
> >       CU_ASSERT(strlen(model) > 0);
> >       CU_ASSERT(strlen(model) < 127);
> >  }
> > --
> > 2.1.0
> >
> >
> > _______________________________________________
> > lng-odp mailing list
> > lng-odp@lists.linaro.org
> > http://lists.linaro.org/mailman/listinfo/lng-odp
>
diff mbox

Patch

diff --git a/test/validation/odp_system.c b/test/validation/odp_system.c
index 2afd4a7..b5742c4 100644
--- a/test/validation/odp_system.c
+++ b/test/validation/odp_system.c
@@ -28,7 +28,7 @@  static void test_odp_sys_cpu_model_str(void)
 {
 	char model[128];
 
-	strcpy(model, odp_sys_cpu_model_str());
+	snprintf(model, 128, "%s", odp_sys_cpu_model_str());
 	CU_ASSERT(strlen(model) > 0);
 	CU_ASSERT(strlen(model) < 127);
 }