It lives, Igor, it lives!


Alright, so that’s probably the one of the most overused blog titles in history (maybe not… google only shows 24 hits) but VisEmacsDotNet — how’s that new name coming, btw? — can send files to Emacs when you invoke the “Send To Emacs” command button.

As an added bonus, a new feature of the VS7 compiler pointed out a buffer overrun in the code. This feature is enabled by the /Gs compiler switch and works by inserting guard bytes in each stack frame. If the guard bytes are modified during the invocation of a function, the compiler aborts with a message…. just not under the VS automation model… it was suppressed. The only indication I had was that devenv.exe was aborting after the call to gnuclient. The problem was relatively simple:


char Name[4096];
hr = get_fullname(generic_doc, Name, sizeof Name);

where get_fullname was trying to be smart, but had the genetic fencepost error:


_snprintf(name, maxch, ""%S"", (BSTR)FullName);
name[maxch] = 0;

Do you see the bug?

One Response to “It lives, Igor, it lives!”

  1. uh, should be maxch-1?