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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/19/2015 07:03 PM, Christophe Fergeau wrote:
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.

Hi Christophe,

I agree it may be confusing.
This is why I specifically mentioned it.
All current users are fine, as Marc-Andre's commits log mention, but
new code in the future may get it wrong.

We can change it with a follow-up patch.

Thanks,
    Uri.
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]