47 lines
1.6 KiB
Plaintext
47 lines
1.6 KiB
Plaintext
$OpenBSD: patch-gettext-runtime_intl_relocatable_c,v 1.4 2013/01/21 22:08:52 naddy Exp $
|
|
--- gettext-runtime/intl/relocatable.c.orig Tue Dec 4 07:28:58 2012
|
|
+++ gettext-runtime/intl/relocatable.c Wed Jan 16 23:06:10 2013
|
|
@@ -462,13 +462,17 @@ relocate (const char *pathname)
|
|
if (pathname[orig_prefix_len] == '\0')
|
|
{
|
|
/* pathname equals orig_prefix. */
|
|
- char *result = (char *) xmalloc (strlen (curr_prefix) + 1);
|
|
+ char *result;
|
|
+ size_t len;
|
|
|
|
+ len = strlen (curr_prefix) + 1;
|
|
+ result = (char *) xmalloc (len);
|
|
+
|
|
#ifdef NO_XMALLOC
|
|
if (result != NULL)
|
|
#endif
|
|
{
|
|
- strcpy (result, curr_prefix);
|
|
+ strlcpy (result, curr_prefix, len);
|
|
return result;
|
|
}
|
|
}
|
|
@@ -476,15 +480,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);
|
|
+ char *result;
|
|
+ size_t len;
|
|
|
|
+ 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;
|
|
}
|
|
}
|