MozillaThunderbird/mozilla-icu-strncat.patch

36 lines
1.3 KiB
Diff
Raw Normal View History

# HG changeset patch
# Parent 29be2a4daa0f512d22bde85b97b5460839026571
# User Wolfgang Rosenauer <wr@rosenauer.org>
From: Jan Engelhardt <jengelh@inai.de>
Reference: http://bugs.icu-project.org/trac/ticket/7808
diff --git a/intl/icu/source/tools/pkgdata/pkgdata.cpp b/intl/icu/source/tools/pkgdata/pkgdata.cpp
--- a/intl/icu/source/tools/pkgdata/pkgdata.cpp
+++ b/intl/icu/source/tools/pkgdata/pkgdata.cpp
@@ -1975,22 +1975,22 @@ static void loadLists(UPKGOptions *o, UE
FILE *p = NULL;
size_t n;
static char buf[512] = "";
char cmdBuf[1024];
UErrorCode status = U_ZERO_ERROR;
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);
}
p = popen(cmdBuf, "r");
}
if(p == NULL || (n = fread(buf, 1, 511, p)) <= 0) {