[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#539338: mkfontscale: add option to recurse subdirectories



Hi Thomas,

a couple comments on the patch.

On Thu, Jul 30, 2009 at 21:00:05 +0200, Thomas Viehmann wrote:

> @@ -831,7 +789,24 @@
>  	}
>  
>          filename = dsprintf("%s%s", dirname, entry->d_name);
> +        if (recurse & (strcmp(entry->d_name, ".") != 0) && (strcmp(entry->d_name, "..") != 0)
                      ^^
                      should be &&

> +	    && (stat(filename, &statbuf) == 0) && S_ISDIR(statbuf.st_mode)) {

this can lead to an infinite loop since you follow symlinks.  Juliusz
suggested limiting the recursion to something like 100.

> +	    char* prefix;
> +	    int retval;
> +	    free(filename);
> +	    filename = dsprintf("%s%s/", dirname, entry->d_name);
> +	    prefix = dsprintf("%s%s/", dir_prefix, entry->d_name);

probably need to check the return value of dsprintf here.

Cheers,
Julien



Reply to: