[PATCH] regedit: fixed a fclose(stdin) issue (Coverity)

Frédéric Delanoy frederic.delanoy at gmail.com
Mon Nov 19 05:41:32 CST 2012


On Sat, Nov 17, 2012 at 9:28 PM, Marcus Meissner <meissner at suse.de> wrote:
> Hi,
>
> If we have multiple filenames on the commandline, and the second one is -,
> we would fclose(stdin) as realname is not NULL.
>
> (And also double free realname.)
>
> So set it back to NULL after free and in the stdin case.
>
> Ciao, Marcus
> ---
>  programs/regedit/regedit.c |    1 +
>  1 Datei geändert, 1 Zeile hinzugefügt(+)
>
> diff --git a/programs/regedit/regedit.c b/programs/regedit/regedit.c
> index acff701..b6f74ee 100644
> --- a/programs/regedit/regedit.c
> +++ b/programs/regedit/regedit.c
> @@ -143,6 +143,7 @@ static BOOL PerformRegAction(REGEDIT_ACTION action, LPSTR s)
>                  if (strcmp(filename, "-") == 0)
>                  {
>                      reg_file = stdin;
> +                    realname = NULL;
>                  }
>                  else
>                  {

realname is set to NULL at the start of every iteration, so this is not useful.

Frédéric



More information about the wine-devel mailing list