Loading ...
Sorry, an error occurred while loading the content.

30024Re: win32 libcall() crash not found

Expand Messages
  • Bruce Mellows
    Oct 9, 2002
      I had a quick look at putting it in and found that the call to
      vim_strsave uses the unsafe strlen() and a safe memmove, and
      vim_strnsave uses the unsafe strncpy(), it looks like there needs to be
      a vim_strnsave_no_strlen(str,n) function that uses memmove without
      checking for length, alternately this could be done in mch_libcall() (I
      am confident this is not acceptable).

      I suppose that Walter would be best to shoehorn this in, as he can
      reproduce the error, and has probably had somewhat more experience at
      providing acceptable patches for vim (none for me).

      Both VirtualQuery() and GetSystemInfo() are available from Windows 95
      and Windows NT 3.1 onwards.

      Bram Moolenaar wrote:

      >Bruce Mellows wrote:
      >>Without the example of the GPF (so please forgive my assumptions, if
      >>they are wrong)...
      >>I have written two functions - safe_strlen and safe_strcpy (and a main
      >>to show it working).
      >>strlen is unsafe, because it just keeps on going and going until it
      >>finds a 0 (think bunny with drum)
      >>strncpy (I guess) is unsafe because it calls strlen (though perhaps it
      >>is inline)
      >Thanks, this shows how to use VirtualQuery() to figure out if a string
      >can be read. I wonder when this function is available. Is this a
      >standard Win32 function?
      >Would be good if you (or someone else) can use this to add the proper
      >check in mch_libcall() in os_mswin.c. It's around where vim_strsave()
      >us used to copy the resulting string to allocated memory.
    • Show all 15 messages in this topic