[PATCH] D39121: [clang-tidy] Misplaced Operator in Strlen in Alloc

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 20 07:11:34 PDT 2017


martong added a comment.

We might get false positives in case of certain substring operations.
Consider the case of copying a substring, pseudo code below:

  const char * s = "abcdefg";
  int offset = my_find('d', s);
  // I want to copy "defg"
  char *new_subststring = (char*) malloc(strlen(s + offset));
  strcpy(...);


https://reviews.llvm.org/D39121





More information about the cfe-commits mailing list