Commit Graph

512 Commits

Author SHA1 Message Date
Marcelo Roberto Jimenez
ad7272d2b5 SF Bug Tracker id 3175217 - Crash bug in Parser_addNamespace()
(This is a fix to commit 86bef09787)
2012-03-13 10:55:06 -03:00
Marcelo Roberto Jimenez
86bef09787 SF Bug Tracker id 3175217 - Crash bug in Parser_addNamespace()
This is a fix to commit 2fb791c9bb.
2012-03-12 11:48:21 -03:00
Fabrice Fontaine
c40d2bc0c9 Remove more implicit casts in upnp part
Remove more "implicit integer or enum conversions" errors as well as
dead code.
2012-03-11 22:45:10 +01:00
Yoichi NAKAYAMA
8e39b2af85 Suppress compiler warning in CreateClientRequestPacketUlaGua.
It is a static function and is called with AF_INET6,
so there is no real problem.
2012-03-11 21:35:03 +09:00
Fabrice Fontaine
2eb3e069ba Remove more implicit casts in upnp part
Remove more "implicit integer or enum conversions" as well as memset
before snprintf.
2012-03-10 22:52:57 +01:00
Yoichi NAKAYAMA
db532afb9b Avoid out of range access in CheckOtherHTTPHeaders.
There was a problem in HDR_ACCEPT_LANGUAGE case.
It may read from TmpBuf larger amount than allocated,
since condition was always true.
Terminate RespInstr->AcceptLanguageHeader correctly.
Skip allocation if there is already sufficient buffer.
2012-03-11 13:21:40 +09:00
Yoichi NAKAYAMA
1b38cc963a Suppress compiler warning in CreateClientRequestPacket.
It is a static function and is called with AF_INET or AF_INET6,
so there is no real problem.
2012-03-11 12:41:32 +09:00
Fabrice Fontaine
c67187ac94 Remove some of the implicit cast in upnp part
Remove some of the "implicit integer or enum conversions" as well as
some access to NULL reference in upnp part.
2012-03-10 20:44:49 +01:00
Fabrice Fontaine
d45f3c28cf Remove lock in ThreadPoolInit
If ThreadPoolInit returned EAGAIN, tp->lock was not freed.
2012-03-10 18:10:42 +01:00
Fabrice Fontaine
06660b6383 Improve ixml
Remove "implicit integer conversions" and
"dereference NULL return value" errors in ixml part.
2012-03-10 17:58:12 +01:00
Yoichi NAKAYAMA
41412c16ef Exclude IPv6 stuff in SearchByTarget when UPNP_ENABLE_IPV6 is not defined. 2012-03-11 04:00:09 +09:00
Yoichi NAKAYAMA
04e5767ea0 Use strncpy with the standard way in readFromSSDPSocket. 2012-03-11 03:54:41 +09:00
Yoichi NAKAYAMA
5944960e17 Respect unique_service_name error in ssdp_request_type.
Respect unique_service_name error in ssdp_request_type
so as not to touch non-terminated buffer under Evt.
2012-03-11 03:52:37 +09:00
Yoichi NAKAYAMA
d952ebfb44 Handle overflow in http_SendMessage. 2012-03-11 03:33:14 +09:00
Yoichi NAKAYAMA
56b44fee91 Detect overflow in addrToString called from configure_urlbase.
Pass output buffer size to addrToString and detect overflow.
Handle addrToString error in configure_urlbase.
2012-03-11 03:25:41 +09:00
Yoichi NAKAYAMA
ff635f92c0 Detect overflow in CreateClientRequestPacket(UlaGua).
Pass output buffer size to CreateClientRequestPacket(UlaGua)
from SearchByTarget and detect overflow.
Handle SearchByTarget error in UpnpSearchAsync.
2012-03-11 02:47:58 +09:00
Yoichi NAKAYAMA
19a23dafba Clarify the last argument of GetDescDocumentAndURL has size LINE_SIZE. 2012-03-11 02:15:16 +09:00
Yoichi NAKAYAMA
bd7f83feb5 For inet_ntop, use buffer with size INET6_ADDRSTRLEN or INET_ADDRSTRLEN. 2012-03-11 01:57:34 +09:00
Yoichi NAKAYAMA
e4678168fa Treat large argument as error in UpnpAddVirtualDir. 2012-03-11 01:40:48 +09:00
Yoichi NAKAYAMA
a0dc3482dc Do not clear buffer before snprintf.
It had no effect since snprintf can overwrite whole buffer.
2012-03-11 01:16:12 +09:00
Yoichi NAKAYAMA
87d1d3c3ec Add assertion and narrow variable scope in resolve_rel_url().
I've confirmed enough buffer is allocated for output.
2012-03-11 00:42:49 +09:00
Yoichi NAKAYAMA
194397b6d6 Handle allocation error in strndup to avoid access violation.
Return NULL before calling strncpy.
Platforms with HAVE_STRNDUP are not affected.
2012-03-10 23:15:37 +09:00
Yoichi NAKAYAMA
b78eaf4e43 Fix buffer size for strncpy in UpnpAddVirtualDir()
Since 1st argument precedes the beginning of the buffer,
it is necessary to reduce the value of 3rd argument.
2012-03-10 22:29:44 +09:00
Yoichi NAKAYAMA
a54d6e7e83 Synchronize autoconfig.h with upnpconfig.h.
It fixes WIN32 build where configure is not invoked.
2012-03-10 14:37:59 +09:00
Yoichi NAKAYAMA
18bf3b1c9c fix missing assignment in commit e722d8c375 2012-03-10 12:50:11 +09:00
Fabrice Fontaine
bb140000c0 More compilaton optimisation
Do not compile most of service_table.c and client_table.c if
--disable-gena is used.
Do not compile urlconfig.c if --disable-webserver is used.
Adding new UPNP_HAVE_xxx variables in upnpconfig.h and upnpconfig.h.in.
2012-03-10 00:33:17 +01:00
Fabrice Fontaine
7aef73d7eb Optimisation of --disable-webserver
Do not compile webserver.c if --disable-webserver is used.
2012-03-09 23:28:18 +01:00
Fabrice
77c73884b8 Improve threadutil
Remove "dereference NULL return" errors and implicit conversions to
double or enum types.
2012-03-09 22:49:19 +01:00
Fabrice Fontaine
72eecacf56 Optimisation of --disable-webserver
Do not compile miniserver.c if --disable-webserver is used.
2012-03-09 17:09:34 +01:00
Fabrice Fontaine
601332f88f Adding configure options
Adding --disable-ssdp, --disable-soap, --disable-gena options to
configure script.
2012-03-09 17:08:01 +01:00
Raymond Wen
4605314569 fix bug: the project can't compile on windows with vs 2005
- define UPNP_USE_MSVCPP when necessary
- set release build's output directory to be consistent with debug build
- add missing ClientSubscription.c to libupnp project
- reference correct source files in sample project

(backport of commit 0097180ce4)
2012-03-09 11:19:18 -03:00
Fabrice Fontaine
e95b4cc53a Bug fix of last commit
_snprintf was wrongly defined in ssdp_server.c
2012-03-09 16:13:43 +01:00
Fabrice Fontaine
e722d8c375 SF Bug Tracker id 3499781 - msvc doesn't have snprintf
Submitted: Yoichi NAKAYAMA ( yoichi ) - 2012-03-08 10:18:39 PST

97a17ff5ad commit breaks build on
windows/msvc since there is no snprintf.

Note:
* Some existing sources use _snprintf when WIN32 is defined, but its
behavior is a bit different from C99 snprintf.
* snprintf does terminate the buffer, so the commit (use buffer size
minus 1 as argument) changes the behavior at the boundary.
* Truncation might be better than crash in some cases. But it may
result in not good.
2012-03-09 15:02:49 +01:00
Marcelo Roberto Jimenez
29ee36b1ca SF Bug Tracker id 3499878 - UpnpUnSubscribeAsync(): ‘retVal’ may be used uninitialized
Submitted: Marcelo Roberto Jimenez ( mroberto ) - 2012-03-08 12:38:57 PST

src/api/upnpapi.c: In function ‘UpnpUnSubscribeAsync’:
src/api/upnpapi.c:2060:6: warning: ‘retVal’ may be used uninitialized in this function
2012-03-08 17:42:02 -03:00
Marcelo Roberto Jimenez
2fb791c9bb SF Bug Tracker id 3175217 - Crash bug in Parser_addNamespace()
Submitted: Terry Farnham ( tfarnham ) - 2011-02-07 09:25:25 PST

Details: The strcmp(pNode->prefix,pCur->prefix) crashes on pCur->prefix
being NULL. This occurs on invalidly formatted xml where a node uses an
undefined namespace. I would expect to receive IXML_FAILED in this
situation.
2012-03-08 13:51:29 -03:00
Marcelo Roberto Jimenez
d909297aa7 White spaces and coding style 2012-03-08 13:39:31 -03:00
Fabrice Fontaine
9b616a08df Removing access to NULL pointers in node.c and element.c
Check that newNode is not NULL ixmlNode_cloneNodeTree and pass newAttr
as the return node in the ixmlElement_setAttributeNodeNS call of
ixmlElement_setAttributeNS.
2012-03-08 16:09:03 +01:00
Fabrice Fontaine
3ab8d536a0 Memory leaks correction in upnpapi.c
Fix memory leaks in UpnpUnSubscribe, SendActionExAsync and
RenewSubscription.
2012-03-08 15:40:23 +01:00
Fabrice Fontaine
4f34a12a83 SF Bug Tracker id 3496993 - Write after free in ixmlNode_insertBefore
Submitted: Fabrice Fontaine ( ffontaine ) - 2012-03-05 04:54:40 PST

If ixmlNode_isParent(nodeptr, newChild) returns TRUE,
ixmlNode_removeChild(nodeptr, newChild, NULL) will free newChild before
the modifications of newChild->nextSibling and newChild->prevSibling.
2012-03-08 14:22:54 +01:00
Fabrice Fontaine
97a17ff5ad Remove most of strcpy, sprintf and strcat
Replace strcpy, sprintf and strcat by strncpy, snprintf and strncat to
avoid buffer overflows.
2012-03-08 14:07:27 +01:00
zephyrus
9965f02727 SF Patches Tracker id 3498437 - a header patch: ixml.h 1.6.15
Submitted: zephyrus ( zephyrus00jp ) - 2012-03-07 02:31:14 PST

Details: a function is declared as
EXPORT_SPEC IXML_Document *ixmlDocument_createDocument();

This should read as follows in order to suppress strict prototype checking by GCC.
EXPORT_SPEC IXML_Document *ixmlDocument_createDocument(void);
2012-03-07 17:15:54 -03:00
Marcelo Roberto Jimenez
861a538cea White spaces, coding style 2012-03-07 15:07:50 -03:00
Marcelo Roberto Jimenez
c12d33aca6 White spaces, coding style 2012-03-07 15:06:26 -03:00
Yoichi NAKAYAMA
4c3532585d SF Bug Tracker id 3497714 - Buffer overflows
Fix compile error on WIN32.

Local variables must be declared first.
Remove outdated comment.
2012-03-08 01:37:03 +09:00
Yoichi NAKAYAMA
71ab707e81 Avoid access violation in assertion.
xmlParser->pCurElement was dereferenced before null check.
Affects debug build only.
2012-03-08 01:22:59 +09:00
Fabrice Fontaine
cec9d55c4c Remove SIZEOF_MISTACH error in notify_send_and_recv
Replace sizeof(CRLF) by strlen(CRLF) as CRLF is a const char*.
2012-03-07 14:30:37 +01:00
Fabrice Fontaine
56c26b5199 SF Bug Tracker id 3498442 - Memory leak in get_file_info
Submitted: Fabrice Fontaine ( ffontaine ) - 2012-03-07 02:44:30 PST

info->contentType is not freed before being set to NULL.
2012-03-07 12:49:13 +01:00
Fabrice Fontaine
0469388b73 SF Bug Tracker id 3498439 - Memory leak in removeServiceTable
Submitted: Fabrice Fontaine ( ffontaine ) - 2012-03-07 02:35:46 PST

UDN is not freed.
2012-03-07 12:41:21 +01:00
Fabrice Fontaine
268abf72fb SF Bug Tracker id 3498436 - Memory leak in Parser_processAttributeName
Submitted: Fabrice Fontaine ( ffontaine ) - 2012-03-07 02:30:57 PST

attr is not freed if ixmlNode_setNodeProperties or
ixmlNode_setAttributeNode return an error in
Parser_processAttributeName.
2012-03-07 12:36:45 +01:00
Fabrice Fontaine
288ef35cee Fixing an error in d6db7c555d commit
Evt.Sid should not be cast into char* when calling sizeof otherwise
size will be 4.
2012-03-07 10:26:42 +01:00