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

30025Re: win32 libcall() crash not found

Expand Messages
  • Bruce Mellows
    Oct 9, 2002
    • 0 Attachment
      This is what I come up with - perhaps Walter could test it.

      Notice that I added the function vim_strnsave_no_strlen() which is
      obviously in the wrong place, and probably not a good name.

      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