home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 7.3 / 7.3.1038 < prev    next >
Encoding:
Internet Message Format  |  2013-05-28  |  4.4 KB

  1. To: vim_dev@googlegroups.com
  2. Subject: Patch 7.3.1038
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 7.3.1038
  11. Problem:    Crash when using Cscope.
  12. Solution:   Avoid negative argument to vim_strncpy(). (Narendran
  13.         Gopalakrishnan)
  14. Files:        src/if_cscope.c
  15.  
  16.  
  17. *** ../vim-7.3.1037/src/if_cscope.c    2013-05-06 04:21:35.000000000 +0200
  18. --- src/if_cscope.c    2013-05-29 19:12:55.000000000 +0200
  19. ***************
  20. *** 2460,2472 ****
  21.   /*
  22.    * PRIVATE: cs_resolve_file
  23.    *
  24. !  * construct the full pathname to a file found in the cscope database.
  25.    * (Prepends ppath, if there is one and if it's not already prepended,
  26.    * otherwise just uses the name found.)
  27.    *
  28. !  * we need to prepend the prefix because on some cscope's (e.g., the one that
  29.    * ships with Solaris 2.6), the output never has the prefix prepended.
  30. !  * contrast this with my development system (Digital Unix), which does.
  31.    */
  32.       static char *
  33.   cs_resolve_file(i, name)
  34. --- 2460,2472 ----
  35.   /*
  36.    * PRIVATE: cs_resolve_file
  37.    *
  38. !  * Construct the full pathname to a file found in the cscope database.
  39.    * (Prepends ppath, if there is one and if it's not already prepended,
  40.    * otherwise just uses the name found.)
  41.    *
  42. !  * We need to prepend the prefix because on some cscope's (e.g., the one that
  43.    * ships with Solaris 2.6), the output never has the prefix prepended.
  44. !  * Contrast this with my development system (Digital Unix), which does.
  45.    */
  46.       static char *
  47.   cs_resolve_file(i, name)
  48. ***************
  49. *** 2493,2506 ****
  50.       if (csdir != NULL)
  51.       {
  52.           vim_strncpy(csdir, (char_u *)csinfo[i].fname,
  53. !             gettail((char_u *)csinfo[i].fname) - 1 - (char_u *)csinfo[i].fname);
  54.           len += (int)STRLEN(csdir);
  55.       }
  56.       }
  57.   
  58. -     if ((fullname = (char *)alloc(len)) == NULL)
  59. -     return NULL;
  60.       /* Note/example: this won't work if the cscope output already starts
  61.        * "../.." and the prefix path is also "../..".  if something like this
  62.        * happens, you are screwed up and need to fix how you're using cscope. */
  63. --- 2493,2504 ----
  64.       if (csdir != NULL)
  65.       {
  66.           vim_strncpy(csdir, (char_u *)csinfo[i].fname,
  67. !                                gettail((char_u *)csinfo[i].fname)
  68. !                          - (char_u *)csinfo[i].fname);
  69.           len += (int)STRLEN(csdir);
  70.       }
  71.       }
  72.   
  73.       /* Note/example: this won't work if the cscope output already starts
  74.        * "../.." and the prefix path is also "../..".  if something like this
  75.        * happens, you are screwed up and need to fix how you're using cscope. */
  76. ***************
  77. *** 2511,2526 ****
  78.           && name[0] != '\\' && name[1] != ':'
  79.   #endif
  80.          )
  81. !     (void)sprintf(fullname, "%s/%s", csinfo[i].ppath, name);
  82. !     else if (csdir != NULL && csinfo[i].fname != NULL && STRLEN(csdir) > 0)
  83.       {
  84.       /* Check for csdir to be non empty to avoid empty path concatenated to
  85. !      * cscope output. TODO: avoid the unnecessary alloc/free of fullname. */
  86. !     vim_free(fullname);
  87.       fullname = (char *)concat_fnames(csdir, (char_u *)name, TRUE);
  88.       }
  89.       else
  90. !     (void)sprintf(fullname, "%s", name);
  91.   
  92.       vim_free(csdir);
  93.       return fullname;
  94. --- 2509,2528 ----
  95.           && name[0] != '\\' && name[1] != ':'
  96.   #endif
  97.          )
  98. !     {
  99. !     if ((fullname = (char *)alloc(len)) != NULL)
  100. !         (void)sprintf(fullname, "%s/%s", csinfo[i].ppath, name);
  101. !     }
  102. !     else if (csdir != NULL && csinfo[i].fname != NULL && *csdir != NUL)
  103.       {
  104.       /* Check for csdir to be non empty to avoid empty path concatenated to
  105. !      * cscope output. */
  106.       fullname = (char *)concat_fnames(csdir, (char_u *)name, TRUE);
  107.       }
  108.       else
  109. !     {
  110. !     fullname = (char *)vim_strsave((char_u *)name);
  111. !     }
  112.   
  113.       vim_free(csdir);
  114.       return fullname;
  115. *** ../vim-7.3.1037/src/version.c    2013-05-29 18:45:07.000000000 +0200
  116. --- src/version.c    2013-05-29 19:17:16.000000000 +0200
  117. ***************
  118. *** 730,731 ****
  119. --- 730,733 ----
  120.   {   /* Add new patch number below this line */
  121. + /**/
  122. +     1038,
  123.   /**/
  124.  
  125. -- 
  126. hundred-and-one symptoms of being an internet addict:
  127. 12. You turn off your modem and get this awful empty feeling, like you just
  128.     pulled the plug on a loved one.
  129.  
  130.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  131. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  132. \\\  an exciting new programming language -- http://www.Zimbu.org        ///
  133.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  134.