aboutsummaryrefslogtreecommitdiffstats
path: root/main/eboard/eboard-const-safety.patch
diff options
context:
space:
mode:
authorCarlo Landmeter <clandmeter@gmail.com>2013-01-04 22:28:33 +0100
committerCarlo Landmeter <clandmeter@gmail.com>2013-01-04 22:28:33 +0100
commit1e191108cef16f3b7afa60c05545e614ed4a7ec9 (patch)
tree42637c6c76d5bf6e54779633ad83646f2fd75266 /main/eboard/eboard-const-safety.patch
parent5521a5f57f91e75ba77e127eccd08a9a833417bb (diff)
downloadaports-1e191108cef16f3b7afa60c05545e614ed4a7ec9.tar.bz2
aports-1e191108cef16f3b7afa60c05545e614ed4a7ec9.tar.xz
main/eboard: fix build on eglibc
Diffstat (limited to 'main/eboard/eboard-const-safety.patch')
-rw-r--r--main/eboard/eboard-const-safety.patch37
1 files changed, 37 insertions, 0 deletions
diff --git a/main/eboard/eboard-const-safety.patch b/main/eboard/eboard-const-safety.patch
new file mode 100644
index 0000000000..de275c3bb6
--- /dev/null
+++ b/main/eboard/eboard-const-safety.patch
@@ -0,0 +1,37 @@
+--- eboard-1.1.1.orig/ntext.cc
++++ eboard-1.1.1/ntext.cc
+@@ -237,6 +237,7 @@
+ void NText::append(const char *text, int len, int color) {
+ int i;
+ NLine *nl;
++ char buf[len + 1];
+ char *p;
+
+ if (len < 0) {
+@@ -244,11 +245,14 @@
+ return;
+ }
+
+- p = strchr(text, '\n');
++ strncpy(buf, text, len);
++ buf[len] = '\0';
++
++ p = strchr(buf, '\n');
+ if (p!=NULL) {
+ *p = 0;
+- i = strlen(text);
+- nl = new NLine(text, color);
++ i = strlen(buf);
++ nl = new NLine(buf, color);
+ *p = '\n';
+ lines.push_back(nl);
+ formatLine(lines.size()-1);
+@@ -257,7 +261,7 @@
+ }
+
+ // if search for \n failed, this is a single line
+- nl = new NLine(text, color);
++ nl = new NLine(buf, color);
+ lines.push_back(nl);
+ formatLine(lines.size()-1);
+ discardExcess();