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

26 lines
1.0 KiB
Plaintext

$OpenBSD: patch-gettext-runtime_intl_log_c,v 1.2 2007/08/25 13:48:23 naddy Exp $
--- gettext-runtime/intl/log.c.orig Mon Nov 27 18:02:00 2006
+++ gettext-runtime/intl/log.c Wed Aug 1 17:17:41 2007
@@ -64,6 +64,7 @@ _nl_log_untranslated_locked (const char *logfilename,
const char *msgid1, const char *msgid2, int plural)
{
FILE *logfile;
+ size_t len;
/* Can we reuse the last opened logfile? */
if (last_logfilename == NULL || strcmp (logfilename, last_logfilename) != 0)
@@ -80,10 +81,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;