[Spice-devel] [vdagent-win PATCH V3 10/11] Fix Visual Studio compiler warning (strcat and sscanf)

Christophe Fergeau cfergeau at redhat.com
Mon Jan 19 09:03:06 PST 2015


On Tue, Dec 30, 2014 at 06:20:56PM +0200, Uri Lublin wrote:
> This is a follow-up to commits 492ee05a6b and 4b9e9b1d28
> 
> Visual Studio complains:
>   .\file_xfer.cpp(90) : warning C4996: 'strcat': This function or variable
>   may be unsafe. Consider using strcat_s instead.
>   To disable deprecation, use _CRT_SECURE_NO_WARNINGS.
>   See online help for details.
> 
> And a similar complain for sscanf.
> 
> Replace them with the secure function when compiling with Visual Studio.
> Note that the size provided is sizeof(d), which means all calls to
> sscanf and strcat must be done with the first param (destination) being
> an array and not a pointer.

This sounds very wrong (same for the strncpy commit) as this is very
uncommon behaviour for something called sscanf/strcat/strncpy, and
this means mingw and visual c++ will behave differently when these
functions are used.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20150119/c7bacac5/attachment.sig>


More information about the Spice-devel mailing list