summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test/clang-tidy/bugprone-misplaced-operator-in-strlen-in-alloc.cpp
diff options
context:
space:
mode:
authorAdam Balogh <adam.balogh@ericsson.com>2017-11-23 12:26:28 +0000
committerAdam Balogh <adam.balogh@ericsson.com>2017-11-23 12:26:28 +0000
commit2079defd8d13d6eebe7d902d08733afbc8198faf (patch)
tree287632b1a57c8cb41373fc79174f8f2cd3b3e6c8 /clang-tools-extra/test/clang-tidy/bugprone-misplaced-operator-in-strlen-in-alloc.cpp
parent6b334a212ebbcb8838168015fc3cfec38713a6d0 (diff)
downloadbcm5719-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
OpenPOWER on IntegriCloud