FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 01-10-2012, 01:10 PM
jjacky
 
Default Moved the check for max depth

Moved the check for max depth when processing an Include
directive, to avoid doing the glob process for nothing.
Added file & line number in max depth error message.

Signed-off-by: Olivier Brunel <i.am.jack.mail@gmail.com>
---
src/pacman/conf.c | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/pacman/conf.c b/src/pacman/conf.c
index 09749ea..2ff16d2 100644
--- a/src/pacman/conf.c
+++ b/src/pacman/conf.c
@@ -700,13 +700,6 @@ static int _parseconfig(const char *file, struct
section_t *section,
int ret = 0;
const int max_depth = 10;

- if(depth >= max_depth) {
- pm_printf(ALPM_LOG_ERROR,
- _("config parsing exceeded max recursion depth of %d.
"), max_depth);
- ret = 1;
- goto cleanup;
- }
-
pm_printf(ALPM_LOG_DEBUG, "config: attempting to read file %s
", file);
fp = fopen(file, "r");
if(fp == NULL) {
@@ -794,6 +787,16 @@ static int _parseconfig(const char *file, struct
section_t *section,
ret = 1;
goto cleanup;
}
+
+ /* if we've reached max depth, we're done */
+ if(depth + 1 >= max_depth) {
+ pm_printf(ALPM_LOG_ERROR,
+ _("config file %s, line %d: parsing exceeded max recursion depth
of %d.
"),
+ file, linenum, max_depth);
+ ret = 1;
+ goto cleanup;
+ }
+
/* Ignore include failures... assume non-critical */
globret = glob(value, GLOB_NOCHECK, NULL, &globbuf);
switch(globret) {
--
1.7.8.3
 

Thread Tools




All times are GMT. The time now is 06:47 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org