aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Bryant <russellbryant@users.sourceforge.net>2008-01-10 03:55:28 +0000
committerRussell Bryant <russellbryant@users.sourceforge.net>2008-01-10 03:55:28 +0000
commit333f803b4d80a3da30a7678328c0c51890bc4c53 (patch)
tree6d705ef877fe7df01429a188c17df15070d6fcfd
parent6adc1e3908b6a30dc4e25ecfc21e93782d63230a (diff)
(from issue #1836228)
This little patch slightly improves pd_makeversion(). Namely, I didn't like the use of sprintf() which ignored the possibility of the version string being longer than the allowed buffer size. Also, I changed malloc+strcpy to the slightly simpler strdup(). svn path=/trunk/; revision=9145
-rw-r--r--packages/patches/buildversion_tweak-0.41.0-test10.patch23
1 files changed, 23 insertions, 0 deletions
diff --git a/packages/patches/buildversion_tweak-0.41.0-test10.patch b/packages/patches/buildversion_tweak-0.41.0-test10.patch
new file mode 100644
index 00000000..7868269b
--- /dev/null
+++ b/packages/patches/buildversion_tweak-0.41.0-test10.patch
@@ -0,0 +1,23 @@
+Index: s_main.c
+===================================================================
+RCS file: /cvsroot/pure-data/pd/src/s_main.c,v
+retrieving revision 1.28.6.6
+diff -u -r1.28.6.6 s_main.c
+--- s_main.c 6 Jan 2008 04:19:15 -0000 1.28.6.6
++++ s_main.c 6 Jan 2008 04:29:01 -0000
+@@ -249,10 +249,11 @@
+ static void pd_makeversion(void)
+ {
+ char foo[100];
+- sprintf(foo, "Pd version %d.%d-%d%s\n",PD_MAJOR_VERSION,
+- PD_MINOR_VERSION,PD_BUGFIX_VERSION,PD_TEST_VERSION);
+- pd_version = malloc(strlen(foo)+1);
+- strcpy(pd_version, foo);
++
++ snprintf(foo, sizeof(foo), "Pd version %d.%d-%d%s\n", PD_MAJOR_VERSION,
++ PD_MINOR_VERSION, PD_BUGFIX_VERSION, PD_TEST_VERSION);
++
++ pd_version = strdup(foo);
+ }
+
+ /* this is called from main() in s_entry.c */