openbsd-ports/devel/gettext/patches/patch-gettext-runtime_intl_log_c

26 lines
1.0 KiB
Plaintext
Raw Normal View History

2010-07-02 23:23:22 -04:00
$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,
2007-08-25 09:48:23 -04:00
{
FILE *logfile;
2010-07-02 23:23:22 -04:00
const char *separator;
+ size_t len;
/* Can we reuse the last opened logfile? */
if (last_logfilename == NULL || strcmp (logfilename, last_logfilename) != 0)
2010-07-02 23:23:22 -04:00
@@ -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)
2010-07-02 23:23:22 -04:00
return;
- strcpy (last_logfilename, logfilename);
+ strlcpy (last_logfilename, logfilename, len);
last_logfile = fopen (logfilename, "a");
if (last_logfile == NULL)
2010-07-02 23:23:22 -04:00
return;