Commit Graph

798 Commits

Author SHA1 Message Date
Sebastian Brandt
97b6be674a Fix for crash in webserver.c by Sebastian Brandt
Dear libupnp-devels,
when POST'ing to the simple web server in libupnp, the application crashes.
This is caused by a missing "..." argument in webserver.c:1533.
Seems it has been there for a long time ... 1.6.9 and 1.6.18 have it.

webserver.c:1533 calls http_MakeMessage
/* Send response. */
http_MakeMessage(&headers, 1, 1,
	 "RTLSXcCc",
	 ret, "text/html", X_USER_AGENT);
The format parameter RTLSXcCc needs four arguments -
R - response code - ret,
T- content type - text/html,
L - struct SendInstruction * - NOT PRESENT
X - user agent - X_USER_AGENT

This results in a crash.

Changing to
http_MakeMessage(&headers, 1, 1,
	 "RTLSXcCc",
	 ret, "text/html", &RespInstr, X_USER_AGENT);
solves the situation.

Yours,
Sebastian Brandt
(cherry picked from commit 25c27b8af7)
2013-07-30 15:35:03 -03:00
Marcelo Roberto Jimenez
da34d1ecfe Fix for portability issue with GNU make extension 'sort'
upnp/sample/Makefile.am:67: warning: sort \
upnp/sample/Makefile.am:67:                     $(tv_ctrlpt_SOURCES: non-POSIX variable name
upnp/sample/Makefile.am:67: (probably a GNU make extension)

Reference:
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13771#8
(cherry picked from commit dcbbc30f5c)
2013-07-30 15:32:13 -03:00
Marcelo Roberto Jimenez
fb04f12a8a Fix for warning issue in libtool
Reference:
http://lists.gnu.org/archive/html/automake/2012-05/msg00014.html

Re: automake 1.12 and AM_PROG_AR

From:	 Nick Bowler
Subject:	 Re: automake 1.12 and AM_PROG_AR
Date:	 Thu, 10 May 2012 17:16:04 -0400
User-agent:	 Mutt/1.5.21 (2010-09-15)
On 2012-05-10 12:52 +0200, Simon Josefsson wrote:
> Hi,
>
> I have received patches similar to the one below for several of my
> projects already, and I'm beginning to think there may be something that
> could be improved in automake.  Why does automake 1.12 need something
> that 1.11 doesn't even recognize?  Perhaps a smoother way to introduce
> this behaviour is to let 1.12 automatically enable it?
>
> Alternatively, is there some other way to address the warnings that is
> better?  Does it indicate a real problem in my projects?
>
> http://lists.gnu.org/archive/html/help-libidn/2012-05/msg00000.html
> http://lists.gnu.org/archive/html/help-libidn/2012-05/txtqAGOGgtPqj.txt

FYI, since the patch is so short it would have been helpful to include
it inline in your email.  I've taken the liberty of reproducing it
below:

> --- libidn-1.24.orig/configure.ac
> +++ libidn-1.24/configure.ac
> @@ -34,6 +34,10 @@ AC_SUBST(LT_CURRENT, 17)
>  AC_SUBST(LT_REVISION, 7)
>  AC_SUBST(LT_AGE, 6)
>
> +# automake 1.12 seems to require this, but automake 1.11 doesn't recognize it
> +m4_pattern_allow([AM_PROG_AR])
> +AM_PROG_AR
> +
>  AC_PROG_CC
>  gl_EARLY
>  lgl_EARLY

First off, this patch seems wrong at a first glance by its use of
m4_pattern_allow: this is saying that "It's ok for AM_PROG_AR to appear
verbatim in the configure script".  This suggests to me that the patch
didn't actually get tested (well) on Automake 1.11, since there will
almost certainly be an error about AM_PROG_AR at configure time.

This one should actually work properly on both old and new Automake
(untested):

  m4_ifdef([AM_PROG_AR], [AM_PROG_AR])

That being said, the new warning is enabled by the -Wextra-portability
option that was added to Automake-1.12.  I'm by no means an export on
this issue, but I think it relates to new support for building with the
Microsoft compiler: in other words, I think that ignoring this warning
will not cause regressions in your package but, instead, your package
will simply not be able to make use of the new feature.

Regardless, I believe that for most packages the new warning is actually
caused by Libtool, and therefore the correct place to add the call to
AM_PROG_AR is in libtool itself, rather than ad-hoc patching of each
package individually.  You can silence the warnings (but not fix them)
by adding -Wno-extra-portability to AM_INIT_AUTOMAKE.

Cheers,
--
Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/)
(cherry picked from commit 3509991872)
2013-07-30 15:32:13 -03:00
Marcelo Roberto Jimenez
2bb79879b7 Security fix for CERT issue VU#922681
This patch addresses three possible buffer overflows in function
unique_service_name(). The three issues have the folowing CVE
numbers:

CVE-2012-5958 Issue #2: Stack buffer overflow of Tempbuf
CVE-2012-5959 Issue #4: Stack buffer overflow of Event->UDN
CVE-2012-5960 Issue #8: Stack buffer overflow of Event->UDN

Notice that the following issues have already been dealt by previous
work:

CVE-2012-5961 Issue #1: Stack buffer overflow of Evt->UDN
CVE-2012-5962 Issue #3: Stack buffer overflow of Evt->DeviceType
CVE-2012-5963 Issue #5: Stack buffer overflow of Event->UDN
CVE-2012-5964 Issue #6: Stack buffer overflow of Event->DeviceType
CVE-2012-5965 Issue #7: Stack buffer overflow of Event->DeviceType
(cherry picked from commit f015a132e8)
2012-12-06 15:46:09 -02:00
Marcelo Roberto Jimenez
6a9baf6058 Merge pull request #7 from Tieske/master
updated request for https://github.com/mrjimenez/pupnp/pull/6
2012-11-13 13:17:19 -08:00
Thijs Schreijer
3f37b55ebc exported the UUID function to enable reuse in client applications 2012-10-21 21:26:11 +02:00
Thijs Schreijer
617bda0ab9 updated ChangeLog 2012-10-14 08:56:47 +02:00
Thijs Schreijer
2a0d73aeac Merge branch 'master' of git://github.com/mrjimenez/pupnp 2012-10-14 08:33:19 +02:00
Thijs Schreijer
05e6644894 added scriptsupport switch to release configuration 2012-09-21 22:20:51 +02:00
Thijs Schreijer
d00e494481 Updated parameter to UpnpAcceptSubscriptionExt to a 'const' declaration, this aligns with UpnpAcceptSubscription 2012-07-11 23:18:23 +02:00
Thijs Schreijer
6c2346a526 added debug output to ignore list
changed some project settings to make debugging available (PDB file didn't match)
2012-07-06 02:11:12 +02:00
Thijs Schreijer
77b7ec848f added ipch folder to ignore list
Added documentation/usage of SCRIPTSUPPORT to the README file.
2012-07-03 21:47:47 +02:00
Thijs Schreijer
cc69373a7d Added the SCRIPTSUPPORT directive to the doxygen configfile so documentation will be generated 2012-06-22 20:59:52 +02:00
Marcelo Roberto Jimenez
9f17244f95 Remove an unused variable
(cherry picked from commit 40e90e89fc)
2012-06-20 22:06:38 -03:00
Marcelo Roberto Jimenez
40d5a1dea3 Remove an unused variable ifndef INET_IPV6
(cherry picked from commit 40ddff1096)
2012-06-20 22:06:38 -03:00
Marcelo Roberto Jimenez
fa9aef8eb6 Remove a pointless way to test a return value
(cherry picked from commit 692813d03e)
2012-06-20 22:06:38 -03:00
Yoichi NAKAYAMA
f67de332a1 Fix memory leak and access violation in UpnpSendAction(Ex)Async.
Free buffers after malloc or ixmlPrintNode failure.
Free Param->Header before destructing Param.
(cherry picked from commit d9e90499b7)
2012-06-20 21:10:23 -03:00
Thijs Schreijer
cb7d43605a Merge branch 'master' of https://github.com/mrjimenez/pupnp 2012-06-11 15:21:56 +02:00
Thijs Schreijer
42dd1ad533 Small documentation updates and updating 2 parameters to the DOMString type for consistency. 2012-06-07 23:31:57 +02:00
Thijs Schreijer
f2cceaf021 cleanup of VC project, removing files from UPnP project that are part of IXML project 2012-06-07 23:30:03 +02:00
Anoop Mohan
4d88a2a4ea Fixes a bug in non blocking connect call
This patch fixes a bug in non blocking connect call where the sock
option length for SO_ERROR was passed as 0 instead of sizeof(int).
(cherry picked from commit 6db2271ac3)
2012-05-25 13:40:32 -03:00
Thijs Schreijer
2b4c5f8168 Added a custom tag (void*) to the Node object and a callback before freeing a Node. This to aid in resource management for a scripting language with auto-garbage collection. 2012-05-06 23:10:07 +02:00
Yoichi NAKAYAMA
dc29948893 Disable SetGenaCallback call if device is disabled.
If device is disabled, SetGenaCallback definition is disabled,
but its call remains. A link error will occur in Win32.
(cherry picked from commit 4d21d45da7)
2012-04-24 14:25:27 -03:00
Yoichi NAKAYAMA
8eaaf0f171 Fix condition for allocation failure in get_content_type().
At the end of get_content_type() in webserver.c, it should check
return value of ixmlCloneDOMString().

(Forward ported from commit 708ea30806)
2012-04-24 14:24:43 -03:00
Yoichi NAKAYAMA
c27a089d6f Fix problems detected as dead assignment warning by clang scan-build.
Wrong assignment by shutdown result hides the real error code
of NewRequestHandler() in ssdp_device.c.
Fix return code description of NewRequestHandler().
Handle return code from ithread_create in sample applications.
Remove unused assignments.

(forward ported from commit 39dfad2cba)
2012-04-24 14:21:47 -03:00
Yoichi NAKAYAMA
76e8812acc Avoid dereference of null pointer in ixmlNode_setNodeProperties.
The problem can occur if one of the arguments is NULL.
Test argument and fix assertion.
(cherry picked from commit 3d7c1dbd59)
2012-04-24 14:16:17 -03:00
Yoichi NAKAYAMA
3b2cfdc45d Create intermediate directory per project on vc9.
Sample applications share sample_util.c and collisions of
object file can occur in parallel build. Modify project files to
split intermediate directories against it.
Apply similar changes also to library projects, like vc10 projects.
(cherry picked from commit e52e7e0bd3)
2012-04-17 10:56:27 -03:00
Thijs Schreijer
e570b7943d Updated the readme regarding the newer visual studio versions and the 'VC runtime dependency hell' 2012-04-11 20:10:52 -03:00
Thijs Schreijer
7d28dd559e Added pthreads folder back in, put in on the ignore list this time so it won't be included in the repository 2012-04-11 20:10:52 -03:00
Thijs Schreijer
e385d5a27e - Copied the VC9 build directory and renamed to VC10 to prepare for Visual Studio 2010 update - Upgraded build/VC10 dir from VC9 to VC10 (using wizard) - Updated the Debug build configuration to be functional, including references for pthread.dll and the web example folders. Other build configurations still to be fixed. - Added output directory to GIT-ignore list. - Updated the Win32 build configurations to make them all work. x64 remains to be done. - Updated build process, after build events (copying sample files and pthreadVC2.dll to the target directory) 2012-04-11 20:10:52 -03:00
Marcelo Roberto Jimenez
4a07690dc4 Update THANKS file
(cherry picked from commit 0ea9c438e5)
2012-04-11 17:46:34 -03:00
Marcelo Roberto Jimenez
b1646eb0a3 Add errno.h inclusion in unixutil.h only in WIN32
(cherry picked from commit c661180d15)
2012-04-11 17:46:34 -03:00
Thijs Schreijer
acc6b4d009 Fixed warning by adding an explicit cast to long; TimerThread.c ..\..\threadutil\src\TimerThread.c(110): warning C4244: '=' : conversion from 'time_t' to 'long', possible loss of data
(cherry picked from commit 1a98394781)
2012-04-11 17:46:34 -03:00
Thijs Schreijer
615f5d18ac Fixed redefinition warnings for EAFNOSUPPORT and EADDRINUSE, Google turned up that they are newly defined in VS2010
unixutil.h, line 41
upnputil.h, line 125

Had a look here; http://bugs.ruby-lang.org/issues/3092 and added the mentioned fixes as found here; http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/include/ruby/win32.h?r1=27222&r2=27236&pathrev=27258&diff_format=h and here http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/include/ruby/win32.h?r1=27236&r2=27258&pathrev=27258&diff_format=h
(cherry picked from commit 89fe655aee)
2012-04-11 17:46:34 -03:00
Yoichi NAKAYAMA
4e25119237 Avoid access violation after parser_parse_chunky_headers call.
In parser_parse_chunky_headers, parser->msg.msg.buf can be changed
by membuffer_delete call. Therefore if we save the pointer to
parser->msg.entity.buf before calling membuffer_delete, it will
induce access to released memory.
(cherry picked from commit d72bb5cff5)
2012-04-11 14:40:57 -03:00
Marcelo Roberto Jimenez
24715afab8 Update THANKS file.
(cherry picked from commit e02753736a)
2012-04-11 12:00:53 -03:00
Gustavo Zacarias
88b94b5116 ssdp_device: exclude IPv6 stuff when there's no IPv6
Add an additional INET_IPV6 exclusion around IPV6_MULTICAST_HOPS since
the definition isn't guaranteed to exist when the toolchain lacks IPv6
support.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
(cherry picked from commit 1c21e6e54f)
2012-04-11 11:57:19 -03:00
Yoichi NAKAYAMA
77559473c1 Remove possibility of access violation.
1. Test Instr before dereference it in http_RecvPostMessage.
(Though it never becomes NULL because NULL is not passed to
the static method)
2. Avoid strdup(NULL) in ixmlElement_setAttributeNS.
Those are detected by llvm scan-build.
(cherry picked from commit a383cbb8e2)
2012-04-10 11:01:04 -03:00
Yoichi NAKAYAMA
79d4b583fe SF Bug Tracker id 3507819 - Use of thread-unsafe gmtime() in httpreadwrite.c
Define http_gmtime_r and web_server_asctime_r and use it.
Those prefix are added since pthread for Win32 already
has macro gmtime_r and asctime_r.

(forward port of commit 34a77cc095)
2012-04-10 11:00:09 -03:00
Yoichi NAKAYAMA
85fd18ad64 Fix type of local variable stopSock in RunMiniServer()
The variable is declared as SOCKET, but it is used to
store return value of int receive_from_stopSock(...).
The type was changed in the commit
4b47e6a51d by mistake.
(cherry picked from commit e10bc2ec0c)
2012-04-10 10:38:14 -03:00
Fabrice Fontaine
320e33ac5a Compilation optimisation
Do not compile the code related to the webserver in http_SendMessage
when --disable-webserver is set
(cherry picked from commit 777c936f4c)
2012-04-03 13:46:09 -03:00
Marcelo Roberto Jimenez
99ef28b091 Homekeeping to match the stable branch release. 2012-04-03 09:56:03 -03:00
Fabrice Fontaine
3d46251c4e Memory leak fix in threadutil
Put thread in a detached state when calling pthread_create otherwise in
some circumstances, thread can end before the call to pthread_detach.
(cherry picked from commit dc4eda529f)
2012-04-03 09:11:47 -03:00
Fabrice Fontaine
b58ee1930c Add --enable-unspecified_server
Add --enable-unspecified_server configure option to set to "Unspecified"
the OS name, OS version, product name and product version normally
contained in the SERVER header as this could be used by an attacker.

(forward port of commit 49af91fe48)
2012-03-30 17:32:31 -03:00
Fabrice Fontaine
57af94b287 Removing implicit casts in miniserver.c
Removing implicit integer or enum casts in miniserver.c.
(cherry picked from commit df27ba505f)
2012-03-30 17:24:07 -03:00
Fabrice Fontaine
0f4458c999 SF Bug Tracker id 3512833 - Miniserver is wrongly disabled
Submitted: Fabrice Fontaine ( ffontaine ) - 2012-03-29 07:36:34 PDT

Miniserver is disabled if ECXLUDE_GENA, EXCLUDE_SOAP and
EXCLUDE_WEBSERVER are set.
However, SSDP needs the Miniserver to answer to M-SEARCH requests.
So, MiniServer should not be disabled if EXCLUDE_SSDP is not also set.
(cherry picked from commit 9a33782ab5)
2012-03-30 17:24:07 -03:00
Yoichi NAKAYAMA
f9ae88182e SF Bug Tracker id 3510693 - build fail with --disable-device
Use INCLUDE_DEVICE_APIS instead of UPNP_HAVE_DEVICE as in other sources.
Don't use soap_device_callback if INCLUDE_DEVICE_APIS is not set,
otherwise link error occur on Windows.
(cherry picked from commit e0e81e6cd2)
2012-03-26 13:51:25 -03:00
Fabrice Fontaine
cc99e6e865 SF Bug Tracker id 3511149 - --disable-ssdp has no effect
Submitted: Yoichi NAKAYAMA ( yoichi ) - 2012-03-25 18:14:34 PDT

There are typos in upnp/src/inc/config.h "EXCLUDE_SSSDP" (shold be
EXCLUDE_SSDP), therefore EXCLUDE_SSDP is always 0, and --disable-ssdp
has no effect.
(cherry picked from commit 02afbb09c9)
2012-03-26 11:32:10 -03:00
Fabrice Fontaine
f99dba3967 Remove implicit casts
Cast parameters of htonl in uint32_t in IN6_IS_ADDR_GLOBAL and
IN6_IS_ADDR_ULA definitions.
Remove comparison with 0 in while statement of vfmatch,
http_SendMessage and http_MakeMessage.
(cherry picked from commit 804088d859)
2012-03-26 11:32:10 -03:00
Yoichi NAKAYAMA
664176c8d6 SF Bug Tracker id 3510693 - build fail with --disable-device
GetDeviceHandleInfo just fail without using undefined member DeviceAf
if UPNP_HAVE_DEVICE is not defined.
Move ContentTypeHeader definition to soap_common.c, since it is
also used in soap_ctrlpt.c.
(cherry picked from commit 679ebeec48)
2012-03-26 11:32:09 -03:00