On Tue, Jul 30, 2019 at 10:56 PM James Bottomley wrote:
>
> On Tue, 2019-07-30 at 16:40 +0800, Chuhong Yuan wrote:
> > strncpy(dest, src, strlen(src)) leads to unterminated
> > dest, which is dangerous.
>
> I don't buy that. The structure is only used for the
> TW_IOCTL_GET_COMPATIBILITY_INFO ioc
On Tue, 2019-07-30 at 16:40 +0800, Chuhong Yuan wrote:
> strncpy(dest, src, strlen(src)) leads to unterminated
> dest, which is dangerous.
I don't buy that. The structure is only used for the
TW_IOCTL_GET_COMPATIBILITY_INFO ioctl and all the fields for that are
fixed width and are copied over as
strncpy(dest, src, strlen(src)) leads to unterminated
dest, which is dangerous.
Here driver_version's len is 32 and TW_DRIVER_VERSION
is shorter than 32.
Therefore strcpy is OK.
Signed-off-by: Chuhong Yuan
---
drivers/scsi/3w-sas.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --gi
3 matches
Mail list logo