Fabrice Fontaine
b7f83bb7c6
Use switch insted of if with enums in threadutil
...
Replace if statements with switch when using enums in threadutil.
2012-03-14 18:52:20 +01:00
Fabrice Fontaine
05fb3f8026
Fix missing break in http_RecvMessage
...
There was a missing break in PARSE_INCOMPLETE_ENTITY due to commit
2eb3e069ba
.
2012-03-14 18:43:14 +01:00
Yoichi NAKAYAMA
7178f300bb
Fix parse failure observed with tvdevice sample.
...
Commit c40d2bc0c9
has a problem
at removing the parentheses in parser_parse_responseline.
Difference of pointers was used with intention, don't cast
them separately.
2012-03-15 01:02:48 +09:00
Yoichi NAKAYAMA
f7a801c3ae
Fix compile error on Windows.
...
Include UpnpStdInt.h for ssize_t.
Define sa_family_t in UpnpInet.h.
2012-03-14 23:40:32 +09:00
Yoichi NAKAYAMA
f299d6597a
Avoid ambiguous change of SsdpEvent in unique_service_name.
...
Handle overflow before changing SsdpEvent.
Because the behavior of "snprintf" is platform dependent in such case.
2012-03-14 23:06:46 +09:00
Yoichi NAKAYAMA
35819a7a44
SF Bug Tracker id 3502958 - The commit 5944960e
prevents a pupnp client (amule) from receiving replies from an IGD device.
...
Previous change broke the feature. The error of unique_service_name
in ssdp_request_type should be ignored.
This reverts commit 5944960e17
.
2012-03-14 23:04:51 +09:00
Marcelo Roberto Jimenez
a692e591de
Address family is an int
...
Reference: "man 2 socket".
2012-03-13 14:32:19 -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
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
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
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
a54d6e7e83
Synchronize autoconfig.h with upnpconfig.h.
...
It fixes WIN32 build where configure is not invoked.
2012-03-10 14:37:59 +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
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
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
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
Fabrice Fontaine
7ef089b09a
Removing two unused variables in ssdp_server.c
...
Removing first TempPtr allocation in unique_service_name as well as one
of the dbgStr allocation in AdvertizeAndReply as those values were not
used.
2012-03-06 18:36:48 +01:00
Fabrice Fontaine
c13b1f7e37
SF Bug Tracker id 3497714 - Buffer overflows
...
Submitted: Fabrice Fontaine ( ffontaine ) - 2012-03-06 07:36:08 PST
Call to strcpy should be replaced by call to memset and strncpy to
avoid getting buffer overflows.
2012-03-06 17:41:47 +01:00
Fabrice Fontaine
3e7bf14488
Merge branch 'branch-1.6.x' of ssh://pupnp.git.sourceforge.net/gitroot/pupnp/pupnp into branch-1.6.x
2012-03-06 09:58:54 +01:00
Fabrice Fontaine
a8bcbe9491
SF Bug Tracker id 3497159 - Bug fix in Parser_readFileOrBuffer
...
Submitted: Fabrice Fontaine ( ffontaine ) - 2012-03-05 14:20:58 PST
fileSize = ftell( xmlFilePtr ); can return a negative value, in this
case the function should exit (at the moment, the function exits only
if ftell returns 0).
2012-03-06 00:23:54 +01:00
Fabrice Fontaine
1a1570fe0f
SF Bug Tracker id 3497140 - Bug fix in http_get_code_text
...
Submitted: Fabrice Fontaine ( ffontaine ) - 2012-03-05 13:07:03 PST
Replace if( statusCode < 100 && statusCode >= 600 ) which can't be true
by if( statusCode < 100 || statusCode >= 600 ).
2012-03-06 00:14:45 +01:00