[ros-dev] [ros-diffs] [cfinck] 37465: Dmitry Gorbachev - Fix compiler warnings, treated as errors due to our settings, which are emitted when using GCC 4.3.2 See issue #3849 for more details.
Matthieu Suiche
msuiche at gmail.com
Wed Nov 19 22:22:31 CET 2008
char buf[MAX_PATH];
[...]
strcat(buf, DIR_SEPARATOR_STRING);
strcat(buf, source);
strcat(buf, entry->d_name);
I'm not sure this is really safe.
--
Matthieu Suiche
On Wed, Nov 19, 2008 at 8:59 PM, <cfinck at svn.reactos.org> wrote:
> Author: cfinck
> Date: Wed Nov 19 13:59:54 2008
> New Revision: 37465
>
> URL: http://svn.reactos.org/svn/reactos?rev=37465&view=rev
> Log:
> Dmitry Gorbachev
> - Fix compiler warnings, treated as errors due to our settings, which are emitted when using GCC 4.3.2
>
> See issue #3849 for more details.
>
> Modified:
> trunk/reactos/tools/cabman/cabinet.cxx
> trunk/reactos/tools/cdmake/cdmake.c
> trunk/reactos/tools/rgenstat/rgenstat.c
>
> Modified: trunk/reactos/tools/cabman/cabinet.cxx
> URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/cabman/cabinet.cxx?rev=37465&r1=37464&r2=37465&view=diff
> ==============================================================================
> --- trunk/reactos/tools/cabman/cabinet.cxx [iso-8859-1] (original)
> +++ trunk/reactos/tools/cabman/cabinet.cxx [iso-8859-1] Wed Nov 19 13:59:54 2008
> @@ -2055,9 +2055,19 @@
> return CAB_STATUS_CANNOT_READ;
> }
>
> - GetFileTimes(SrcFile, FileNode);
> -
> - GetAttributesOnFile(FileNode);
> + if (GetFileTimes(SrcFile, FileNode) != CAB_STATUS_SUCCESS)
> + {
> + DPRINT(MIN_TRACE, ("Cannot read file times.\n"));
> + FreeMemory(NewFileName);
> + return CAB_STATUS_CANNOT_READ;
> + }
> +
> + if (GetAttributesOnFile(FileNode) != CAB_STATUS_SUCCESS)
> + {
> + DPRINT(MIN_TRACE, ("Cannot read file attributes.\n"));
> + FreeMemory(NewFileName);
> + return CAB_STATUS_CANNOT_READ;
> + }
>
> CloseFile(SrcFile);
>
> @@ -3646,7 +3656,8 @@
> strcpy(buf, File->FileName);
> else
> {
> - getcwd(buf, sizeof(buf));
> + if (!getcwd(buf, sizeof(buf)))
> + return CAB_STATUS_CANNOT_READ;
> strcat(buf, DIR_SEPARATOR_STRING);
> strcat(buf, File->FileName);
> }
> @@ -3689,7 +3700,8 @@
> strcpy(buf, File->FileName);
> else
> {
> - getcwd(buf, sizeof(buf));
> + if (!getcwd(buf, sizeof(buf)))
> + return CAB_STATUS_CANNOT_READ;
> strcat(buf, DIR_SEPARATOR_STRING);
> strcat(buf, File->FileName);
> }
>
> Modified: trunk/reactos/tools/cdmake/cdmake.c
> URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/cdmake/cdmake.c?rev=37465&r1=37464&r2=37465&view=diff
> ==============================================================================
> --- trunk/reactos/tools/cdmake/cdmake.c [iso-8859-1] (original)
> +++ trunk/reactos/tools/cdmake/cdmake.c [iso-8859-1] Wed Nov 19 13:59:54 2008
> @@ -882,7 +882,8 @@
> }
> else
> {
> - getcwd(buf, sizeof(buf));
> + if (!getcwd(buf, sizeof(buf)))
> + error_exit("Can't get CWD: %s\n", strerror(errno));
> strcat(buf, DIR_SEPARATOR_STRING);
> strcat(buf, source);
> strcat(buf, entry->d_name);
> @@ -943,7 +944,8 @@
> }
> else
> {
> - getcwd(buf, sizeof(buf));
> + if (!getcwd(buf, sizeof(buf)))
> + error_exit("Can't get CWD: %s\n", strerror(errno));
> strcat(buf, DIR_SEPARATOR_STRING);
> strcat(buf, source);
> }
> @@ -994,7 +996,8 @@
> }
> else
> {
> - getcwd(buf, sizeof(buf));
> + if (!getcwd(buf, sizeof(buf)))
> + error_exit("Can't get CWD: %s\n", strerror(errno));
> strcat(buf, DIR_SEPARATOR_STRING);
> strcat(buf, source);
> strcat(buf, entry->d_name);
>
> Modified: trunk/reactos/tools/rgenstat/rgenstat.c
> URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rgenstat/rgenstat.c?rev=37465&r1=37464&r2=37465&view=diff
> ==============================================================================
> --- trunk/reactos/tools/rgenstat/rgenstat.c [iso-8859-1] (original)
> +++ trunk/reactos/tools/rgenstat/rgenstat.c [iso-8859-1] Wed Nov 19 13:59:54 2008
> @@ -553,7 +553,11 @@
> }
> else
> {
> - getcwd(buf, sizeof(buf));
> + if (!getcwd(buf, sizeof(buf)))
> + {
> + printf("Can't get CWD: %s\n", strerror(errno));
> + return;
> + }
> strcat(buf, DIR_SEPARATOR_STRING);
> strcat(buf, path);
> strcat(buf, entry->d_name);
> @@ -611,7 +615,11 @@
> }
> else
> {
> - getcwd(buf, sizeof(buf));
> + if (!getcwd(buf, sizeof(buf)))
> + {
> + printf("Can't get CWD: %s\n", strerror(errno));
> + return;
> + }
> strcat(buf, DIR_SEPARATOR_STRING);
> strcat(buf, path);
> strcat(buf, entry->d_name);
>
>
More information about the Ros-dev
mailing list