TooTallNate / ref

Turn Buffer instances into "pointers"
http://tootallnate.github.com/ref
453 stars 141 forks source link

#define snprintf _snprintf_s #11

Closed fjhub closed 10 years ago

fjhub commented 10 years ago

Unfortunately, linux snprintf() and windows snprintf() are not identical in that the windows version does not guarantee that the string is null terminated. One can use _snprintf_s() guarantee that the string is null terminated.

The msdn docs for_snprintf_s() has this call taking an additional argument for identifying the maximum number of characters (or _TRUNCATE) in order for it to behave like linux snprintf() call.

Is the missing third argument a (potential) defect in binding.cc?

TooTallNate commented 10 years ago

Hey there. Great catch! I'm not too familiar with the particulars between Unix and Windows functions, so you may very well be correct. Care to try your hand at a patch to correct it for us?