From 47c28e7ece3373c90d0af47b2c1733bcb18a47e9 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Mon, 5 Jul 2010 16:49:25 -0400 Subject: [PATCH] Do not depend on strlcpy/strlcat --- plugins/sample_group/plugin_test.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/plugins/sample_group/plugin_test.c b/plugins/sample_group/plugin_test.c index a0893095b..4bafe81d5 100644 --- a/plugins/sample_group/plugin_test.c +++ b/plugins/sample_group/plugin_test.c @@ -75,27 +75,19 @@ group_plugin_load(char *plugin_info) { char *args, path[PATH_MAX], savedch; char **argv = NULL; - size_t len; int rc; /* * Fill in .so path and split out args (if any). */ - path[0] = '\0'; - if (plugin_info[0] != '/') - strlcpy(path, "./", sizeof(path)); if ((args = strpbrk(plugin_info, " \t")) != NULL) { savedch = *args; *args = '\0'; } - len = strlcat(path, plugin_info, sizeof(path)); + strncpy(path, plugin_info, sizeof(path) - 1); + path[sizeof(path) - 1] = '\0'; if (args != NULL) *args++ = savedch; - if (len >= sizeof(path)) { - fprintf(stderr, "%s%s: %s\n", "./", plugin_info, - strerror(ENAMETOOLONG)); - return -1; - } /* Open plugin and map in symbol. */ group_handle = dlopen(path, RTLD_LAZY);