[PATCH] fixed if check before strchr
James Hawkins
truiken at gmail.com
Tue May 6 15:05:18 CDT 2008
On Tue, May 6, 2008 at 3:00 PM, Eric Pouech <eric.pouech at orange.fr> wrote:
> Marcus Meissner a écrit :
>
>
> > Hi,
> >
> > spotted by Coverity (CID 701), a if (!spath) should be if (spath).
> >
> > Ciao, Marcus
> > ---
> > programs/winedbg/source.c | 2 +-
> > 1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/programs/winedbg/source.c b/programs/winedbg/source.c
> > index 5519c57..1db7092 100644
> > --- a/programs/winedbg/source.c
> > +++ b/programs/winedbg/source.c
> > @@ -128,7 +128,7 @@ static BOOL source_locate_file(const char* srcfile, char* path)
> > while (!found)
> > {
> > spath = strchr(spath, '\\');
> > - if (!spath) spath = strchr(spath, '/');
> > + if (spath) spath = strchr(spath, '/');
> > if (!spath) break;
> > spath++;
> > found = SearchPathA(dbg_curr_process->search_path, spath, NULL, MAX_PATH, path, NULL);
> >
> actually no
> the code intends to find the first occurence of / or \
> A+
>
Then you have to use a different variable than spath. If you don't
find '\\', then you'll pass NULL into the second strchr.
--
James Hawkins
More information about the wine-devel
mailing list