diff options
author | Adam Balogh <adam.balogh@ericsson.com> | 2017-11-23 12:26:28 +0000 |
---|---|---|
committer | Adam Balogh <adam.balogh@ericsson.com> | 2017-11-23 12:26:28 +0000 |
commit | 2079defd8d13d6eebe7d902d08733afbc8198faf (patch) | |
tree | 287632b1a57c8cb41373fc79174f8f2cd3b3e6c8 /clang-tools-extra/test/clang-tidy/bugprone-misplaced-operator-in-strlen-in-alloc.cpp | |
parent | 6b334a212ebbcb8838168015fc3cfec38713a6d0 (diff) | |
download | bcm5719-llvm-2079defd8d13d6eebe7d902d08733afbc8198faf.tar.gz bcm5719-llvm-2079defd8d13d6eebe7d902d08733afbc8198faf.zip |
[clang-tidy] Misplaced Operator in Strlen in Alloc
A possible error is to write `malloc(strlen(s+1))` instead of
`malloc(strlen(s)+1)`. Unfortunately the former is also valid syntactically,
but allocates less memory by two bytes (if s` is at least one character long,
undefined behavior otherwise) which may result in overflow cases. This check
detects such cases and also suggests the fix for them.
llvm-svn: 318906
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/bugprone-misplaced-operator-in-strlen-in-alloc.cpp')
0 files changed, 0 insertions, 0 deletions