[ros-dev] Re : [ros-diffs] [cfinck] 33547: Make 100% sure that the correct "regedit.exe" is launched by using GetWindowsDirectory and appending "\regedit.exe" as suggested by Alex on ros-dev.
Sylvain Petreolle
spetreolle at yahoo.fr
Sat May 17 16:57:56 CEST 2008
Maybe _tcscat_s should be used instead ?
Kind regards,
Sylvain Petreolle (aka Usurp)
Support artists, not multinationals - http://Iwouldntsteal.net
Supportez les artistes, pas les multinationales - http://Iwouldntsteal.net
----- Message d'origine ----
> De : Alex Ionescu <ionucu at videotron.ca>
> À : ros-dev at reactos.org
> Envoyé le : Samedi, 17 Mai 2008, 16h00mn 00s
> Objet : Re: [ros-dev] [ros-diffs] [cfinck] 33547: Make 100% sure that the correct "regedit.exe" is launched by using GetWindowsDirectory and appending "\regedit.exe" as suggested by Alex on ros-dev.
>
> This is still wrong. Tcscat is completely unsafe and can result in you
> overwriting the path as soon as the user has a windows path longer
> than MAX_PATH - sizeof("regedit.exe").
>
> Please use the PathAppend API for this.
>
> On Sat, May 17, 2008 at 5:39 PM, wrote:
> > Author: cfinck
> > Date: Sat May 17 04:39:36 2008
> > New Revision: 33547
> >
> > URL: http://svn.reactos.org/svn/reactos?rev=33547&view=rev
> > Log:
> > Make 100% sure that the correct "regedit.exe" is launched by using
> GetWindowsDirectory and appending "\regedit.exe" as suggested by Alex on
> ros-dev.
> >
> > Modified:
> > trunk/reactos/base/applications/regedt32/regedt32.c
> >
> > Modified: trunk/reactos/base/applications/regedt32/regedt32.c
> > URL:
> http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedt32/regedt32.c?rev=33547&r1=33546&r2=33547&view=diff
> > ==============================================================================
> > --- trunk/reactos/base/applications/regedt32/regedt32.c [iso-8859-1]
> (original)
> > +++ trunk/reactos/base/applications/regedt32/regedt32.c [iso-8859-1] Sat May
> 17 04:39:36 2008
> > @@ -5,7 +5,12 @@
> > int WINAPI _tWinMain(HINSTANCE hCurInst, HINSTANCE hPrevInst,
> > LPTSTR lpsCmdLine, int nCmdShow)
> > {
> > - ShellExecute(NULL, NULL, _T("regedit.exe"), lpsCmdLine, NULL, nCmdShow);
> > + TCHAR szPath[MAX_PATH];
> > +
> > + GetWindowsDirectory(szPath, MAX_PATH);
> > + _tcscat(szPath, _T("\\regedit.exe"));
> > +
> > + ShellExecute(NULL, NULL, szPath, lpsCmdLine, NULL, nCmdShow);
> >
> > return 0;
> > }
> >
> >
>
>
>
> --
> Best regards,
> Alex Ionescu
> _______________________________________________
> Ros-dev mailing list
> Ros-dev at reactos.org
> http://www.reactos.org/mailman/listinfo/ros-dev
More information about the Ros-dev
mailing list