* [PATCH] staging: ced1401: userspace: use1401.c: Cleaning up missing null-terminate in conjunction with strncpy
@ 2014-07-26 23:10 Rickard Strandqvist
2014-07-27 18:44 ` Greg Kroah-Hartman
0 siblings, 1 reply; 3+ messages in thread
From: Rickard Strandqvist @ 2014-07-26 23:10 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rickard Strandqvist
Cc: Monam Agarwal, devel, linux-kernel
Replacing strncpy with strlcpy to avoid strings that lacks null terminate.
And replacing strncat with strlcat because of incorrect use.
Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
---
drivers/staging/ced1401/userspace/use1401.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/ced1401/userspace/use1401.c b/drivers/staging/ced1401/userspace/use1401.c
index 7b8a222..2d15df8 100644
--- a/drivers/staging/ced1401/userspace/use1401.c
+++ b/drivers/staging/ced1401/userspace/use1401.c
@@ -693,7 +693,7 @@ U14API(short) U14DriverName(short hand, char* pBuf, unsigned short wMax)
case 3: pName = "HSS"; break;
default: pName = "???"; break;
}
- strncpy(pBuf, pName, wMax); // Copy the correct name to return
+ strlcpy(pBuf, pName, wMax); /* Copy the correct name to return */
return U14ERR_NOERROR;
}
@@ -1079,7 +1079,7 @@ U14API(short) U14NameOf1401(short hand, char* pBuf, unsigned short wMax)
case U14TYPEPOWER3:pName = "Power1401-3"; break;
default: pName = "Unknown";
}
- strncpy(pBuf, pName, wMax);
+ strlcpy(pBuf, pName, wMax);
}
return sErr;
}
@@ -2891,10 +2891,10 @@ U14API(unsigned int) U14Ld(short hand, const char* vl, const char* str)
++dwIndex; // Keep count of command number, first is 1
szFName[iLoop2]=(char)0; // null terminate name of command
- strncpy(szLastName, szFName, sizeof(szLastName)); // Save for error info
- szLastName[sizeof(szLastName)-1] = 0;
- strncat(szLastName, szFExt, sizeof(szLastName)); // with extension included
- szLastName[sizeof(szLastName)-1] = 0;
+ /* Save for error info */
+ strlcpy(szLastName, szFName, sizeof(szLastName));
+ /* with extension included */
+ strlcat(szLastName, szFExt, sizeof(szLastName));
U14SendString(hand, szFName); // ask if loaded
U14SendString(hand, ";ERR;"); // add err return
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: ced1401: userspace: use1401.c: Cleaning up missing null-terminate in conjunction with strncpy
2014-07-26 23:10 [PATCH] staging: ced1401: userspace: use1401.c: Cleaning up missing null-terminate in conjunction with strncpy Rickard Strandqvist
@ 2014-07-27 18:44 ` Greg Kroah-Hartman
2014-07-27 21:30 ` Rickard Strandqvist
0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2014-07-27 18:44 UTC (permalink / raw)
To: Rickard Strandqvist; +Cc: devel, linux-kernel, Monam Agarwal
On Sun, Jul 27, 2014 at 01:10:25AM +0200, Rickard Strandqvist wrote:
> Replacing strncpy with strlcpy to avoid strings that lacks null terminate.
> And replacing strncat with strlcat because of incorrect use.
>
> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
> ---
> drivers/staging/ced1401/userspace/use1401.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
This file is no longer in my tree :(
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: ced1401: userspace: use1401.c: Cleaning up missing null-terminate in conjunction with strncpy
2014-07-27 18:44 ` Greg Kroah-Hartman
@ 2014-07-27 21:30 ` Rickard Strandqvist
0 siblings, 0 replies; 3+ messages in thread
From: Rickard Strandqvist @ 2014-07-27 21:30 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: devel, linux-kernel@vger.kernel.org, Monam Agarwal
2014-07-27 20:44 GMT+02:00 Greg Kroah-Hartman <gregkh@linuxfoundation.org>:
> On Sun, Jul 27, 2014 at 01:10:25AM +0200, Rickard Strandqvist wrote:
>> Replacing strncpy with strlcpy to avoid strings that lacks null terminate.
>> And replacing strncat with strlcat because of incorrect use.
>>
>> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
>> ---
>> drivers/staging/ced1401/userspace/use1401.c | 12 ++++++------
>> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> This file is no longer in my tree :(
Hi
No, it does not exist in Linux-next anymore... I must keep better
track of linux-next :-/
Kind regards
Rickard Strandqvist
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-07-27 21:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-26 23:10 [PATCH] staging: ced1401: userspace: use1401.c: Cleaning up missing null-terminate in conjunction with strncpy Rickard Strandqvist
2014-07-27 18:44 ` Greg Kroah-Hartman
2014-07-27 21:30 ` Rickard Strandqvist
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox