search for: string_compare

Displaying 2 results from an estimated 2 matches for "string_compare".

2012 Feb 29
1
[PATCH 1/2] Check that directory path is not too long (found by Coverity).
...les changed, 12 insertions(+), 4 deletions(-) diff --git a/helper/appliance.c b/helper/appliance.c index c4d0b32..05ad3e5 100644 --- a/helper/appliance.c +++ b/helper/appliance.c @@ -168,15 +168,23 @@ iterate_input_directory (const char *dirname, int dirfd, struct writer *writer) sort (entries, string_compare); char path[PATH_MAX]; - strcpy (path, dirname); + char *inputs[] = { path }; size_t len = strlen (dirname); + + if (len + 1 >= PATH_MAX) + error (EXIT_FAILURE, 0, "%s: directory name too long", __func__); + + strcpy (path, dirname); path[len++] = '/'; - ch...
2014 Feb 25
2
[PATCH supermin v4] Supermin 5 rewrite.
.../ - goto cpio; - else - /* No, must be hostfiles, case (2). */ - add_hostfiles (inputs[i], writer); - } - else - error (EXIT_FAILURE, 0, "%s: input is not a regular file or directory", - inputs[i]); - - close (fd); - } -} - -static int -string_compare (const void *p1, const void *p2) -{ - return strcmp (* (char * const *) p1, * (char * const *) p2); -} - -static void -iterate_input_directory (const char *dirname, int dirfd, struct writer *writer) -{ - DIR *dir = fdopendir (dirfd); - if (dir == NULL) - error (EXIT_FAILURE, errno, "fdop...