summaryrefslogtreecommitdiff
path: root/icu
diff options
context:
space:
mode:
authorTomáš Chvátal <tchvatal@suse.cz>2012-12-23 13:21:27 +0100
committerTomáš Chvátal <tchvatal@suse.cz>2012-12-23 13:21:27 +0100
commit80af815ce0e4453a1960c39aaa8ebb4f5e412136 (patch)
treef1592f3bc0a73ef7fb095ce10b9da499ae1f8290 /icu
parent9c655c4c55e3be85a6cef0bd04f95e4d47e211f1 (diff)
Add icu patch to avoid buffer overflow, taken from obs
Change-Id: I42ae81279fedca04b7ba08269a6c47f174cf6b01
Diffstat (limited to 'icu')
-rw-r--r--icu/icu4c-buffer-overflow.patch29
-rw-r--r--icu/makefile.mk1
2 files changed, 30 insertions, 0 deletions
diff --git a/icu/icu4c-buffer-overflow.patch b/icu/icu4c-buffer-overflow.patch
new file mode 100644
index 000000000000..1f3d2ca71b8c
--- /dev/null
+++ b/icu/icu4c-buffer-overflow.patch
@@ -0,0 +1,29 @@
+I: Statement might be overflowing a buffer in strncat. Common mistake:
+ BAD: strncat(buffer,charptr,sizeof(buffer)) is wrong, it takes the left over size as 3rd argument
+ GOOD: strncat(buffer,charptr,sizeof(buffer)-strlen(buffer)-1)
+E: icu bufferoverflowstrncat pkgdata.cpp:299:87
+
+---
+ source/tools/pkgdata/pkgdata.cpp | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+Index: icu/source/tools/pkgdata/pkgdata.cpp
+===================================================================
+--- icu.orig/source/tools/pkgdata/pkgdata.cpp
++++ icu/source/tools/pkgdata/pkgdata.cpp
+@@ -1914,12 +1914,12 @@ static void loadLists(UPKGOptions *o, UE
+ const char cmd[] = "icu-config --incpkgdatafile";
+
+ /* #1 try the same path where pkgdata was called from. */
+- findDirname(progname, cmdBuf, 1024, &status);
++ findDirname(progname, cmdBuf, sizeof(cmdBuf), &status);
+ if(U_SUCCESS(status)) {
+ if (cmdBuf[0] != 0) {
+- uprv_strncat(cmdBuf, U_FILE_SEP_STRING, 1024);
++ uprv_strncat(cmdBuf, U_FILE_SEP_STRING, sizeof(cmdBuf)-1-strlen(cmdBuf));
+ }
+- uprv_strncat(cmdBuf, cmd, 1024);
++ uprv_strncat(cmdBuf, cmd, sizeof(cmdBuf)-1-strlen(cmdBuf));
+
+ if(verbose) {
+ fprintf(stdout, "# Calling icu-config: %s\n", cmdBuf);
diff --git a/icu/makefile.mk b/icu/makefile.mk
index 2d50a2411e66..5494fa554f45 100644
--- a/icu/makefile.mk
+++ b/icu/makefile.mk
@@ -57,6 +57,7 @@ PATCH_FILES=\
icu4c-macosx.patch \
icu4c-solarisgcc.patch \
icu4c-mkdir.patch \
+ icu4c-buffer-overflow.patch \
.IF "$(OS)"=="ANDROID"
PATCH_FILES+=\