diff options
author | Hangbin Liu <[email protected]> | 2019-11-20 16:38:08 +0800 |
---|---|---|
committer | David S. Miller <[email protected]> | 2019-11-20 22:23:36 -0800 |
commit | 9bb59a21f53e7231696257d5e6283a4fbacfb43f (patch) | |
tree | 74a2d5c284838dca140388d71a7f226057aa9b36 /scripts/gdb/linux/tasks.py | |
parent | c0d59da79534e85eb550d863e35eccc8c3fd8ceb (diff) |
tcp: warn if offset reach the maxlen limit when using snprintf
snprintf returns the number of chars that would be written, not number
of chars that were actually written. As such, 'offs' may get larger than
'tbl.maxlen', causing the 'tbl.maxlen - offs' being < 0, and since the
parameter is size_t, it would overflow.
Since using scnprintf may hide the limit error, while the buffer is still
enough now, let's just add a WARN_ON_ONCE in case it reach the limit
in future.
v2: Use WARN_ON_ONCE as Jiri and Eric suggested.
Suggested-by: Jiri Benc <[email protected]>
Signed-off-by: Hangbin Liu <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Diffstat (limited to 'scripts/gdb/linux/tasks.py')
0 files changed, 0 insertions, 0 deletions