diff options
| author | Patrick McHardy <kaber@trash.net> | 2005-01-09 21:42:43 -0800 |
|---|---|---|
| committer | David S. Miller <davem@nuts.davemloft.net> | 2005-01-09 21:42:43 -0800 |
| commit | af4be1268e05f8c9a7036780a3f1269ea6abff2c (patch) | |
| tree | f0a98248fae48e4edd42091159b59874f165f034 /include/linux/rtnetlink.h | |
| parent | 06fe37b462c2812ba234912d7523b8804642fc4a (diff) | |
[PKT_SCHED]: Add rtattr_strlcpy, use it where appropriate
Add rtattr_strlcpy to handle unterminated strings. The destination
is nulled out entirely to avoid possible leaks when dumping. The
return value can be checked for >= size to detect truncated strings.
Currently strings equal to the size of the destination are accepted
everywhere even if not null-terminated. Sometimes they are silently
truncated, sometimes the unterminated string is used.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/rtnetlink.h')
| -rw-r--r-- | include/linux/rtnetlink.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index 1f02d87be6b7..c3d5d043a5ca 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h @@ -748,6 +748,7 @@ struct tcamsg #include <linux/config.h> +extern size_t rtattr_strlcpy(char *dest, const struct rtattr *rta, size_t size); static __inline__ int rtattr_strcmp(const struct rtattr *rta, const char *str) { int len = strlen(str) + 1; |
