mips: math-emu: replace deprecated strcpy() in me-debugfs
PATCH 1/1 mips: math-emu: replace deprecated strcpy() in me-debugfs
use strscpy() instead of deprecated strcpy().
--- arch/mips/math-emu/me-debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/math-emu/me-debugfs.c +1 -1
@@ -41,7 +41,7 @@ static void adjust_instruction_counter_name(char *out_name, char *in_name) {int i =0 ; -strcpy (out_name, in_name); +strscpy (out_name, in_name,sizeof (out_name));while (in_name[i] !='\0' ) {if (out_name[i] =='_' ) out_name[i] ='.' ;
Signature · 1 line
2.43.0
Thomas Bogendoerfer
maintainerQuoted 12 lines · Osama Abdelkader
use
strscpy()instead of deprecatedstrcpy().Signed-off-by Osama Abdelkader <[email protected]>--- arch/mips/math-emu/me-debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/mips/math-emu/me-debugfs.c +0
-0
arch/mips/math-emu/me-debugfs.c static void adjust_instruction_counter_name(char *out_name, char *in_name) · line 44
Quoted 5 lines
arch/mips/math-emu/me-debugfs.c +1
-1@@ -41,7 +41,7 @@ static void adjust_instruction_counter_name(char *out_name, char *in_name) {int i =0 ; -strcpy (out_name, in_name); +strscpy (out_name, in_name,sizeof (out_name));
this is wrong. sizeof(out_name) is the size of the pointer, but not the size of the storage behind it. To be able to use strscpy() here you need to pass in the size of the given buffer and use that.
Thomas.
Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]
Quoted 16 lines · Thomas Bogendoerfer
Quoted 15 lines · Osama Abdelkader
use
strscpy()instead of deprecatedstrcpy().Signed-off-by Osama Abdelkader <[email protected]>--- arch/mips/math-emu/me-debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/mips/math-emu/me-debugfs.c +0
-0@@ -41,7 +41,7 @@ static void adjust_instruction_counter_name(char *out_name, char *in_name) {int i =0 ;
Quoted 9 lines
arch/mips/math-emu/me-debugfs.c static void adjust_instruction_counter_name(char *out_name, char *in_name) · line 44
Quoted 2 lines
arch/mips/math-emu/me-debugfs.c +1
-1-strcpy (out_name, in_name); +strscpy (out_name, in_name,sizeof (out_name));this is wrong.
sizeof(out_name)is the size of the pointer, but not the size of the storage behind it. To be able to usestrscpy()here you need to pass in the size of the given buffer and use that.Thomas.
Thanks Thomas, I just sent v2.
Regards,
Osama
Quoted 3 lines
Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]