openbsd-ports/devel/gettext/patches/patch-gettext-runtime_intl_relocatable_c
2007-08-25 13:48:23 +00:00

27 lines
902 B
Plaintext

$OpenBSD: patch-gettext-runtime_intl_relocatable_c,v 1.2 2007/08/25 13:48:23 naddy Exp $
--- gettext-runtime/intl/relocatable.c.orig Mon Nov 27 18:02:00 2006
+++ gettext-runtime/intl/relocatable.c Wed Aug 1 17:17:41 2007
@@ -448,15 +448,19 @@ relocate (const char *pathname)
{
/* pathname starts with orig_prefix. */
const char *pathname_tail = &pathname[orig_prefix_len];
- char *result =
- (char *) xmalloc (curr_prefix_len + strlen (pathname_tail) + 1);
+ size_t len;
+ char *result;
+
+ len = curr_prefix_len + strlen (pathname_tail) + 1;
+ result = (char *) xmalloc (len);
#ifdef NO_XMALLOC
if (result != NULL)
#endif
{
memcpy (result, curr_prefix, curr_prefix_len);
- strcpy (result + curr_prefix_len, pathname_tail);
+ result[curr_prefix_len] = '\0';
+ strlcat (result, pathname_tail, len);
return result;
}
}