INN commit: branches/2.4/lib (perl.c)
INN Commit
Russ_Allbery at isc.org
Sun Jun 29 17:55:05 UTC 2008
Date: Sunday, June 29, 2008 @ 10:55:04
Author: iulius
Revision: 7929
Use snprintf instead of asprintf.
Modified:
branches/2.4/lib/perl.c
--------+
perl.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
Modified: perl.c
===================================================================
--- perl.c 2008-06-29 17:27:22 UTC (rev 7928)
+++ perl.c 2008-06-29 17:55:04 UTC (rev 7929)
@@ -122,13 +122,16 @@
if (startupfile != NULL && filterfile != NULL) {
char *evalfile = NULL;
+ size_t length;
dSP;
ENTER ;
SAVETMPS ;
- /* The Perl expression which will be evaluated. */
- asprintf(&evalfile, "do '%s'", startupfile);
+ /* The Perl expression which will be evaluated. */
+ length = strlen("do '%s'") + strlen(startupfile);
+ evalfile = xmalloc(length);
+ snprintf(evalfile, length, "do '%s'", startupfile);
PerlSilence();
perl_eval_pv(evalfile, TRUE);
@@ -163,7 +166,8 @@
dSP ;
char *argv[] = { NULL };
char *evalfile = NULL;
-
+ size_t length;
+
ENTER ;
SAVETMPS ;
@@ -178,7 +182,9 @@
}
/* The Perl expression which will be evaluated. */
- asprintf(&evalfile, "do '%s'", filterfile);
+ length = strlen("do '%s'") + strlen(filterfile);
+ evalfile = xmalloc(length);
+ snprintf(evalfile, length, "do '%s'", filterfile);
PerlSilence();
perl_eval_pv(evalfile, TRUE);
@@ -194,7 +200,9 @@
/* If the reload failed we don't want the old definition hanging
around. */
- asprintf(&evalfile, "undef &%s", function);
+ length = strlen("undef &%s") + strlen(function);
+ evalfile = xmalloc(length);
+ snprintf(evalfile, length, "undef &%s", function);
perl_eval_pv(evalfile, TRUE);
if (SvTRUE(ERRSV)) /* check $@ */ {
More information about the inn-committers
mailing list