Warning for non secure sprintf on VS2008!

View: New views
2 Messages — Rating Filter:   Alert me  

Warning for non secure sprintf on VS2008!

by Ümit Uzun :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Hi All,

New version of OpenAL11CoreSDK has updated for secure file and console operations. But there is sprintf which omitted about this changing I think. When I build new version framework I have get warning about security on VS2008, I think sprintf should be changed to sprintf_s as follows;

ALchar *ALFWaddMediaPath(const ALchar *filename)
{
    // sprintf(fullPath, "%s%s", "..\\..\\Media\\", filename); Obsolete one
    sprintf_s(fullPath, _MAX_PATH, "%s%s", "..\\..\\Media\\", filename);
    return fullPath;
}

Regards.

Ümit Uzun

_______________________________________________
Openal mailing list
Openal@...
http://opensource.creative.com/mailman/listinfo/openal

Re: Warning for non secure sprintf on VS2008!

by Stephen A. :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The function 'sprintf_s' is a non-standard Microsoft extension to C89. As such, it cannot be used if cross-compiler support is desired. Easiest solution: turn off warnings for "security deprecations" in your compiler.

The C99 standard includes a safe alternative in the form of snprintf.



On Mon, Jul 20, 2009 at 10:04 AM, Ümit Uzun <umituzun84@...> wrote:
Hi All,

New version of OpenAL11CoreSDK has updated for secure file and console operations. But there is sprintf which omitted about this changing I think. When I build new version framework I have get warning about security on VS2008, I think sprintf should be changed to sprintf_s as follows;

ALchar *ALFWaddMediaPath(const ALchar *filename)
{
    // sprintf(fullPath, "%s%s", "..\\..\\Media\\", filename); Obsolete one
    sprintf_s(fullPath, _MAX_PATH, "%s%s", "..\\..\\Media\\", filename);
    return fullPath;
}

Regards.

Ümit Uzun

_______________________________________________
Openal mailing list
Openal@...
http://opensource.creative.com/mailman/listinfo/openal



_______________________________________________
Openal mailing list
Openal@...
http://opensource.creative.com/mailman/listinfo/openal