Add infoSize parameter to get_sdk_info
Add infoSize parameter to get_sdk_info function to replace sprintf call by a snprintf call. (cherry picked from commit e13ffe3bf84f7238b57bde73a4780cbf70bcc511)
This commit is contained in:
parent
c42216dad7
commit
1aecc6c44f
@ -318,6 +318,13 @@ Version 1.8.0
|
||||
Version 1.6.16
|
||||
*******************************************************************************
|
||||
|
||||
2012-03-18 Fabrice Fontaine <fabrice.fontaine(at)orange.com>
|
||||
|
||||
Add infoSize parameter to get_sdk_info
|
||||
|
||||
Add infoSize parameter to get_sdk_info function to replace sprintf call
|
||||
by a snprintf call.
|
||||
|
||||
2012-03-16 Fabrice Fontaine <fabrice.fontaine(at)orange.com>
|
||||
|
||||
Check return code in ixml
|
||||
|
@ -1588,7 +1588,7 @@ int http_MakeMessage(membuffer *buf, int http_major_version,
|
||||
} else if (c == 'S' || c == 'U') {
|
||||
/* SERVER or USER-AGENT header */
|
||||
temp_str = (c == 'S') ? "SERVER: " : "USER-AGENT: ";
|
||||
get_sdk_info(tempbuf);
|
||||
get_sdk_info(tempbuf, sizeof(tempbuf));
|
||||
if (http_MakeMessage(buf, http_major_version, http_minor_version,
|
||||
"ss", temp_str, tempbuf) != 0)
|
||||
goto error_handler;
|
||||
@ -1949,6 +1949,7 @@ int http_OpenHttpGetEx(
|
||||
*
|
||||
* Parameters:
|
||||
* OUT char *info; buffer to store the operating system information
|
||||
* IN size_t infoSize; size of buffer
|
||||
*
|
||||
* Description:
|
||||
* Returns the server information for the operating system
|
||||
@ -1957,14 +1958,14 @@ int http_OpenHttpGetEx(
|
||||
* UPNP_INLINE void
|
||||
************************************************************************/
|
||||
/* 'info' should have a size of at least 100 bytes */
|
||||
void get_sdk_info(OUT char *info)
|
||||
void get_sdk_info(OUT char *info, IN size_t infoSize)
|
||||
{
|
||||
#ifdef WIN32
|
||||
OSVERSIONINFO versioninfo;
|
||||
versioninfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
||||
|
||||
if (GetVersionEx(&versioninfo) != 0)
|
||||
sprintf(info,
|
||||
snprintf(info, infoSize,
|
||||
"%d.%d.%d %d/%s, UPnP/1.0, Portable SDK for UPnP devices/"
|
||||
PACKAGE_VERSION "\r\n", versioninfo.dwMajorVersion,
|
||||
versioninfo.dwMinorVersion, versioninfo.dwBuildNumber,
|
||||
@ -1978,7 +1979,7 @@ void get_sdk_info(OUT char *info)
|
||||
ret_code = uname(&sys_info);
|
||||
if (ret_code == -1)
|
||||
*info = '\0';
|
||||
sprintf(info,
|
||||
snprintf(info, infoSize,
|
||||
"%s/%s, UPnP/1.0, Portable SDK for UPnP devices/"
|
||||
PACKAGE_VERSION "\r\n", sys_info.sysname, sys_info.release);
|
||||
#endif
|
||||
|
@ -2,6 +2,7 @@
|
||||
*
|
||||
* Copyright (c) 2000-2003 Intel Corporation
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2012 France Telecom All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@ -616,6 +617,7 @@ int http_OpenHttpGetEx(IN const char *url_str,
|
||||
*
|
||||
* Parameters:
|
||||
* OUT char *info; buffer to store the operating system information
|
||||
* IN size_t infoSize; size of buffer
|
||||
*
|
||||
* Description:
|
||||
* Returns the server information for the operating system
|
||||
@ -623,7 +625,7 @@ int http_OpenHttpGetEx(IN const char *url_str,
|
||||
* Return:
|
||||
* UPNP_INLINE void
|
||||
************************************************************************/
|
||||
void get_sdk_info( OUT char *info );
|
||||
void get_sdk_info( OUT char *info, IN size_t infoSize );
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* #extern "C" */
|
||||
|
Loading…
x
Reference in New Issue
Block a user