aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/runtime/main.c
diff options
context:
space:
mode:
authorJanne Blomqvist <jb@gcc.gnu.org>2011-04-16 20:43:03 +0300
committerJanne Blomqvist <jb@gcc.gnu.org>2011-04-16 20:43:03 +0300
commitd30fe1c5cdc98c83c1d29d6b20f88a13328faddd (patch)
treea18b46c3ac70b0e29558cbe228eaa2af23e758b9 /libgfortran/runtime/main.c
parent9c575e20c33a032619b063d243f6e7320fcda878 (diff)
downloadgcc-d30fe1c5cdc98c83c1d29d6b20f88a13328faddd.zip
gcc-d30fe1c5cdc98c83c1d29d6b20f88a13328faddd.tar.gz
gcc-d30fe1c5cdc98c83c1d29d6b20f88a13328faddd.tar.bz2
Replace sprintf with snprintf
From-SVN: r172590
Diffstat (limited to 'libgfortran/runtime/main.c')
-rw-r--r--libgfortran/runtime/main.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libgfortran/runtime/main.c b/libgfortran/runtime/main.c
index 28247ca..f5d4721 100644
--- a/libgfortran/runtime/main.c
+++ b/libgfortran/runtime/main.c
@@ -1,7 +1,8 @@
-/* Copyright (C) 2002-2003, 2005, 2007, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2003, 2005, 2007, 2009, 2011
+ Free Software Foundation, Inc.
Contributed by Andy Vaught and Paul Brook <paul@nowt.org>
-This file is part of the GNU Fortran 95 runtime library (libgfortran).
+This file is part of the GNU Fortran runtime library (libgfortran).
Libgfortran is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -107,8 +108,9 @@ store_exe_path (const char * argv0)
#endif
/* exe_path will be cwd + "/" + argv[0] + "\0" */
- path = malloc (strlen (cwd) + 1 + strlen (argv0) + 1);
- sprintf (path, "%s%c%s", cwd, DIR_SEPARATOR, argv0);
+ size_t pathlen = strlen (cwd) + 1 + strlen (argv0) + 1;
+ path = malloc (pathlen);
+ snprintf (path, pathlen, "%s%c%s", cwd, DIR_SEPARATOR, argv0);
exe_path = path;
please_free_exe_path_when_done = 1;
}