NoQ added a comment.

Whoops - this isn't quite correct because there's one more difference between 
strlcpy/strlcat and the standard strcpy/strcat/strncpy/strncat: the return 
value. After this patch the new functions are modeled as if they return a 
pointer into the string, which is incorrect and in fact causes crashes.

One of the crashes is on the following code:

  int foo(char *d) {
    char e[1];
    return strlcpy(e, d, sizeof(e)) >= sizeof(e);
  }

...when analyzed as `clang -cc1 -w -analyze -analyzer-checker=core,unix 
repro.c`.

David, would you be willing to have a look at this problem?

Also I forgot to add the tests before committing. Sorry!


Repository:
  rC Clang

https://reviews.llvm.org/D45177



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to