mozilla-icu-strncat.patch
changeset 885 ee3c462047d5
parent 882 82af81b0a6c7
parent 884 d9d863421693
child 886 2e9f984bca7f
child 887 5d23fade3143
equal deleted inserted replaced
882:82af81b0a6c7 885:ee3c462047d5
     1 # HG changeset patch
       
     2 # Parent 29be2a4daa0f512d22bde85b97b5460839026571
       
     3 # User Wolfgang Rosenauer <wr@rosenauer.org>
       
     4 # Parent  a7d16f0faf5d4881dbea524340f881d5850710e4
       
     5 From: Jan Engelhardt <jengelh@inai.de>
       
     6 Reference: http://bugs.icu-project.org/trac/ticket/7808
       
     7 
       
     8 diff --git a/intl/icu/source/tools/pkgdata/pkgdata.cpp b/intl/icu/source/tools/pkgdata/pkgdata.cpp
       
     9 --- a/intl/icu/source/tools/pkgdata/pkgdata.cpp
       
    10 +++ b/intl/icu/source/tools/pkgdata/pkgdata.cpp
       
    11 @@ -1975,22 +1975,22 @@ static void loadLists(UPKGOptions *o, UE
       
    12      FILE *p = NULL;
       
    13      size_t n;
       
    14      static char buf[512] = "";
       
    15      char cmdBuf[1024];
       
    16      UErrorCode status = U_ZERO_ERROR;
       
    17      const char cmd[] = "icu-config --incpkgdatafile";
       
    18  
       
    19      /* #1 try the same path where pkgdata was called from. */
       
    20 -    findDirname(progname, cmdBuf, 1024, &status);
       
    21 +    findDirname(progname, cmdBuf, sizeof(cmdBuf), &status);
       
    22      if(U_SUCCESS(status)) {
       
    23        if (cmdBuf[0] != 0) {
       
    24 -          uprv_strncat(cmdBuf, U_FILE_SEP_STRING, 1024);
       
    25 +          uprv_strncat(cmdBuf, U_FILE_SEP_STRING, sizeof(cmdBuf)-1-strlen(cmdBuf));
       
    26        }
       
    27 -      uprv_strncat(cmdBuf, cmd, 1024);
       
    28 +      uprv_strncat(cmdBuf, cmd, sizeof(cmdBuf)-1-strlen(cmdBuf));
       
    29        
       
    30        if(verbose) {
       
    31          fprintf(stdout, "# Calling icu-config: %s\n", cmdBuf);
       
    32        }
       
    33        p = popen(cmdBuf, "r");
       
    34      }
       
    35  
       
    36      if(p == NULL || (n = fread(buf, 1, 511, p)) <= 0) {