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

30022Re: win32 libcall() crash not found

Expand Messages
  • Bram Moolenaar
    Oct 9, 2002
      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.

      --
      hundred-and-one symptoms of being an internet addict:
      178. You look for an icon to double-click to open your bedroom window.

      /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
      /// Creator of Vim - Vi IMproved -- http://www.vim.org \\\
      \\\ Project leader for A-A-P -- http://www.a-a-p.org ///
      \\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html ///
    • Show all 15 messages in this topic