From 1e191108cef16f3b7afa60c05545e614ed4a7ec9 Mon Sep 17 00:00:00 2001 From: Carlo Landmeter Date: Fri, 4 Jan 2013 22:28:33 +0100 Subject: main/eboard: fix build on eglibc --- main/eboard/eboard-const-safety.patch | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 main/eboard/eboard-const-safety.patch (limited to 'main/eboard/eboard-const-safety.patch') 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(); -- cgit v1.2.3