openbsd-ports/devel/gettext/patches/patch-gettext-runtime_intl_log_c
2010-07-03 03:23:22 +00:00

26 lines
1.0 KiB
Plaintext

$OpenBSD: patch-gettext-runtime_intl_log_c,v 1.3 2010/07/03 03:23:22 naddy Exp $
--- gettext-runtime/intl/log.c.orig Mon Jun 28 20:31:59 2010
+++ gettext-runtime/intl/log.c Mon Jun 28 23:05:31 2010
@@ -68,6 +68,7 @@ _nl_log_untranslated_locked (const char *logfilename,
{
FILE *logfile;
const char *separator;
+ size_t len;
/* Can we reuse the last opened logfile? */
if (last_logfilename == NULL || strcmp (logfilename, last_logfilename) != 0)
@@ -84,10 +85,11 @@ _nl_log_untranslated_locked (const char *logfilename,
last_logfilename = NULL;
}
/* Open the logfile. */
- last_logfilename = (char *) malloc (strlen (logfilename) + 1);
+ len = strlen (logfilename) + 1;
+ last_logfilename = (char *) malloc (len);
if (last_logfilename == NULL)
return;
- strcpy (last_logfilename, logfilename);
+ strlcpy (last_logfilename, logfilename, len);
last_logfile = fopen (logfilename, "a");
if (last_logfile == NULL)
return;