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