From 549c2878f965e5b6cb001ff3c8c5e3122becf8e1 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 13 Jan 2008 14:14:34 -0600 Subject: Disallow a NULL section in _parseconfig If we allow _parseconfig to continue processing when section is not defined, then we have the potential to segfault during strcmp calls. This is no good. For some reason, we had existing logic that tested this case but only if it was processing and 'Include' directive. Expand the check to check for a NULL section in all cases, and print an error message if this is the case. Reported here: http://bbs.archlinux.org/viewtopic.php?id=42235 Signed-off-by: Dan McGee --- src/pacman/pacman.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index 1aa29682..27130254 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -606,8 +606,8 @@ static int _parseconfig(const char *file, const char *givensection, * follow the toupper() rules we may expect, e.g. tr_TR where i != I. */ upperkey = strtoupper(strdup(key)); - if(section == NULL && (strcmp(key, "Include") == 0 || strcmp(upperkey, "INCLUDE") == 0)) { - pm_printf(PM_LOG_ERROR, _("config file %s, line %d: 'Include' directive must belong to a section.\n"), + if(section == NULL) { + pm_printf(PM_LOG_ERROR, _("config file %s, line %d: All directives must belong to a section.\n"), file, linenum); return(1); } -- cgit v1.2.3-70-g09d2 From 307f4d73015ee9fda6ae8c76d8bad14c3a48fb6d Mon Sep 17 00:00:00 2001 From: Chantry Xavier Date: Tue, 15 Jan 2008 00:48:31 +0100 Subject: Revert "Fix case where pacman asks for confirmation when it should not" yesno function already handles noconfirm. No need to do it twice. This reverts commit dffa0654f2eae1c427a74c647d22f0bbd201ccf7. --- src/pacman/remove.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/pacman/remove.c b/src/pacman/remove.c index fde5c737..56837fa2 100644 --- a/src/pacman/remove.c +++ b/src/pacman/remove.c @@ -155,8 +155,7 @@ int pacman_remove(alpm_list_t *targets) list_display(_("Targets:"), lst); FREELIST(lst); /* get confirmation */ - if(!config->noconfirm - && yesno(_("\nDo you want to remove these packages? [Y/n] ")) == 0) { + if(yesno(_("\nDo you want to remove these packages? [Y/n] ")) == 0) { remove_cleanup(); FREELIST(finaltargs); return(1); -- cgit v1.2.3-70-g09d2