]> granicus.if.org Git - libevent/commitdiff
Replace (safe) use of strcpy with memcpy to appease OpenBSD
authorNick Mathewson <nickm@torproject.org>
Fri, 14 May 2010 18:36:49 +0000 (14:36 -0400)
committerNick Mathewson <nickm@torproject.org>
Fri, 14 May 2010 18:36:49 +0000 (14:36 -0400)
If Libevent uses strcpy, even safely, it seems OpenBSD's linker will
complain every time a library links Libevent.  It's easier just not to
use the old thing, even when it's safe to do so.

http.c

diff --git a/http.c b/http.c
index 5d3631fc53b22d0bcb207e77e1fb3ac89f5db208..c4fb09c525164709aa89af9055abb7ed227b2338 100644 (file)
--- a/http.c
+++ b/http.c
@@ -249,9 +249,9 @@ evhttp_htmlescape(const char *html)
        }
        for (i = 0; i < old_size; ++i) {
                const char *replaced = html_replace(html[i], scratch_space);
-               /* this is length checked */
-               strcpy(p, replaced);
-               p += strlen(replaced);
+               size_t len = strlen(replaced);
+               memcpy(p, replaced, len);
+               p += len;
        }
 
        *p = '\0';