#1192 libcurl should use the strlcat from <string.h>

closed-fixed
None
5
2013-06-21
2013-02-11
No

--- lib/strequal.h.orig 2013-02-08 09:04:39.000000000 -0800
+++ lib/strequal.h 2013-02-08 09:05:41.000000000 -0800
@@ -35,9 +35,10 @@
/ case insensitive strstr() /
char Curl_strcasestr(const char haystack, const char *needle);

-#ifndef HAVE_STRLCAT
+#ifdef HAVE_STRLCAT
+#include <string.h>
+#else
#define strlcat(x,y,z) Curl_strlcat(x,y,z)
#endif
-size_t strlcat(char dst, const char src, size_t siz);

#endif

Discussion

  • Daniel Stenberg

    Daniel Stenberg - 2013-02-11

    It isn't quite that simple I believe. Many systems don't have a strlcat() in string.h. I believe we have build combinations where the strlcat() configure finds is actually provided by one of 3rd party libraries (one of the krb libs iirc)

    Are you suggesting that your change makes any real difference apart from being "more correct" to some level?

     
  • Daniel Stenberg

    Daniel Stenberg - 2013-02-11
    • assigned_to: Daniel Stenberg
    • milestone: -->
     
  • Jeremy Huddleston Sequoia

    It makes a real difference in instances where strlcat() is actually implemented as a macro in system headers and <string.h> is included before "strequal.h" ... this will likely become more of a problem as more systems support _FORTIFY_SOURCE for strlcpy and strlcat which is being supported now on clang/llvm trunk.

     
  • Daniel Stenberg

    Daniel Stenberg - 2013-02-13

    Thanks, I'm now working on removing the strlcat() implementation and the two remaining uses of it. I posted a patch on this list about it:

    http://curl.haxx.se/mail/lib-2013-02/0214.html

     
  • Daniel Stenberg

    Daniel Stenberg - 2013-02-14

    This commit is now pushed and this bug report is thereby also addressed. Thanks for your report!

     
  • Daniel Stenberg

    Daniel Stenberg - 2013-02-14
    • status: open --> closed-fixed
     
  • Jeremy Huddleston Sequoia

    Thanks. FWIW, I reviewed the src changes, and they look good.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks