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