drivers/net/wireless/iwlegacy: use strlcpy instead of strncpy
Subsystems (3)
PATCH 1/1 drivers/net/wireless/iwlegacy: use strlcpy instead of strncpy
The fields must be null-terminated, or simple_strtoul will cause issue.
--- drivers/net/wireless/iwlegacy/3945-mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/iwlegacy/3945-mac.c +1 -1
@@ -3273,7 +3273,7 @@ il3945_store_measurement(struct device *d, struct device_attribute *attr,if (count) {char *p = buffer; -strncpy (buffer, buf,min (sizeof (buffer), count)); +strlcpy (buffer, buf,sizeof (buffer)); channel =simple_strtoul (p,NULL ,0 );if (channel) params.channel = channel;
Signature · 1 line
1.7.10.4
Quoted 4 lines · Chen Gang
The fields must be null-terminated, or
simple_strtoulwill cause issue.Signed-off-by Chen Gang <[email protected]>
ACK
Quoted 2 lines · Stanislaw Gruszka
Quoted 1 line
Quoted 1 line
Signed-off-by Chen Gang <[email protected]>ACK
thank you very much.
:-)
Signature · 3 lines
Chen Gang Flying Transformer
begin:vcard
fn:Chen Gang
n:;Chen Gang
version:2.1
end:vcard
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hello all:
sorry, after checking the details:
I think this patch is incorrect.
we can not assume that the parameter "char *buf" is terminated by '\0' so we should only use strlcpy instead of strncpy, without touching 'min(...'
since it is already integrated into main branch (at least, in next-20130118).
I should send additional patch to fix it.
please help to check, thanks.
gchen.
Quoted 22 lines · Chen Gang
The fields must be null-terminated, or
simple_strtoulwill cause issue.Signed-off-by Chen Gang <[email protected]>--- drivers/net/wireless/iwlegacy/3945-mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/wireless/iwlegacy/3945-mac.c +1
-1@@ -3273,7 +3273,7 @@ il3945_store_measurement(struct device *d, struct device_attribute *attr,if (count) {char *p = buffer; -strncpy (buffer, buf,min (sizeof (buffer), count)); +strlcpy (buffer, buf,sizeof (buffer)); channel =simple_strtoul (p,NULL ,0 );if (channel) params.channel = channel;
Signature · 3 lines
Chen Gang Asianux Corporation
oh, sorry, it is my fault.
according to fill_write_buffer in fs/sysfs/file.c,
we can assume that 'const char *buf' must be '\0' based string.
please skip original reply.
gchen.
Quoted 41 lines · Chen Gang
Hello all:
sorry, after checking the details:
I think this patch is incorrect.
we can not assume that the parameter "char *buf" is terminated by '\0' so we should only use strlcpy instead of strncpy, without touching 'min(...'since it is already integrated into main branch (at least, in next-20130118).
I should send additional patch to fix it.please help to check, thanks.
gchen.
Quoted 22 lines · Chen Gang
The fields must be null-terminated, or
simple_strtoulwill cause issue.Signed-off-by Chen Gang <[email protected]>--- drivers/net/wireless/iwlegacy/3945-mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/wireless/iwlegacy/3945-mac.c +1
-1@@ -3273,7 +3273,7 @@ il3945_store_measurement(struct device *d, struct device_attribute *attr,if (count) {char *p = buffer; -strncpy (buffer, buf,min (sizeof (buffer), count)); +strlcpy (buffer, buf,sizeof (buffer)); channel =simple_strtoul (p,NULL ,0 );if (channel) params.channel = channel;
Signature · 3 lines
Chen Gang Flying Transformer
begin:vcard
fn:Chen Gang
n:;Chen Gang
version:2.1
end:vcard