From 657be653400bdb9fc8ab13037e51ecfbc1af9d40 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Fri, 6 Apr 2007 01:04:07 +0000 Subject: Misc fixes, plugged a memory leak in runscript.c and use va_copy to avoid nasty segfaults --- src/rc-plugin.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/rc-plugin.c') diff --git a/src/rc-plugin.c b/src/rc-plugin.c index c02b6a81..b742eadd 100644 --- a/src/rc-plugin.c +++ b/src/rc-plugin.c @@ -47,6 +47,7 @@ void rc_plugin_load (void) void *h = dlopen (p, RTLD_LAZY); char *func; void *f; + int len; if (! h) { @@ -57,8 +58,9 @@ void rc_plugin_load (void) func = file; file = strsep (&func, "."); - func = rc_xmalloc (strlen (file) + strlen ("__hook") + 1); - sprintf (func, "_%s_hook", file); + len = strlen (file) + 7; + func = rc_xmalloc (sizeof (char *) * len); + snprintf (func, len, "_%s_hook", file); f = dlsym (h, func); if (! f) -- cgit v1.2.3