From bad00696f34bd37243d0db411c26319ef0f640d8 Mon Sep 17 00:00:00 2001 From: Andrew Gregory Date: Sat, 7 Jul 2012 15:12:49 -0400 Subject: query_fileowner: break/continue pkgfile loop Break out of pkgfile loop on match or continue if the pkgfile path is too long. Signed-off-by: Andrew Gregory --- src/pacman/query.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/pacman/query.c b/src/pacman/query.c index 9b1ea6f1..a14b3e36 100644 --- a/src/pacman/query.c +++ b/src/pacman/query.c @@ -212,12 +212,14 @@ static int query_fileowner(alpm_list_t *targets) if(strcmp(pkgfile, bname) == 0) { print_query_fileowner(filename, info); found = 1; + break; } continue; } if(rootlen + 1 + strlen(pkgfile) > PATH_MAX) { pm_printf(ALPM_LOG_ERROR, _("path too long: %s%s\n"), root, pkgfile); + continue; } /* concatenate our file and the root path */ strcpy(path + rootlen, pkgfile); @@ -229,6 +231,8 @@ static int query_fileowner(alpm_list_t *targets) if(ppath && strcmp(ppath, rpath) == 0) { print_query_fileowner(filename, info); found = 1; + free(ppath); + break; } free(ppath); } -- cgit v1.2.3-70-g09d2