Commit Graph

47 Commits

Author SHA1 Message Date
Thomas Bernard 184ed52069
upnpc.c: fix SetRedirectAndTest() args. 2021-01-04 01:16:02 +01:00
Thomas Bernard 82e874ada9
remove build warning.
PortMappingNumberOfEntries is supposed to be limited to 65536

should fix #501
2020-11-09 20:38:45 +01:00
Pali Rohár 8cd542a809 Fix snprintf emulation for Windows
* Move it into separate win32_snprintf.h file to de-duplicate its
  implementation from all miniupnp source files.

* Do not use this emulation with mingw32 SDK when __NO_ISOCEXT is not
  defined as in this case mingw32 provides working snprintf function.

* Fix detection for mingw-w64 variants, when __NO_ISOCEXT is defined or
  when older version without UCRT is used.

* Add check if _scprintf function is available. In case it is not available
  just returns length of filled buffer to prevent buffer overflow.
2020-10-18 20:29:53 +02:00
Pali Rohár f5f693876d miniupnpc: By default skip invalid, disconnected and non-IGD devices
Allow to use such IGD devices by new -i option.
2020-10-05 22:30:30 +02:00
Pali Rohár 7d5fdf0743 miniupnpc: Fix usage of Windows _snprintf() function
_snprintf() differs from snprintf() in:

* on overflow it returns -1 instead of required buffer size
* on overflow it does not fill nul byte
* does not accept NULL/0 as a buffer

Microsoft implemented snprintf() in Visual Studio 2015 as part of UCRT.

Mingw32 contains snprintf() implementation only when __USE_MINGW_ANSI_STDIO
is defined.

Mingw-w64 versions prior to 8.0.0. contain snprintf() implementation when
__USE_MINGW_ANSI_STDIO or _UCRT is defined. Since version 8.0.0 it is
always supported.

Mingw-w64 defines both __MINGW32__ and __MINGW64_VERSION_MAJOR macros.
Mingw32 defines only __MINGW32__.

_scprintf() just count number of bytes needed for formatting string, so it
is basically return value of snprintf().

This change updates miniupnpc code to use snprintf() when is provided by
compiler/runtime to avoid usage _snprintf().

And also this changes updates miniupnpc emulation of snprintf() by
_snprintf() and _scprintf() functions to avoid buffer overflows.

For inspiration full emulation of snprintf() by _snprintf() is available in
mingw-w64 stdio library:

https://sourceforge.net/p/mingw-w64/mingw-w64/ci/master/tree/mingw-w64-crt/stdio/snprintf.c
2020-10-02 22:32:36 +02:00
Thomas Bernard 4436632866
2019=>2020 2020-02-20 09:04:23 +01:00
jlayec e1ff22b20d manage [remote host] 2019-07-13 12:39:33 +02:00
Thomas Bernard 922372bff3 2019 2019-04-08 14:46:11 +02:00
Thomas Bernard 154d27c773 miniupnpc/upnpc.c: 2017=>2018 2018-04-20 16:34:42 +02:00
Thomas Bernard a4af4a66b2 miniupnpc: cleanup includes in upnpcommands.h
see #289
2018-03-14 00:36:12 +01:00
Thomas Bernard ce2673118d miniupnpc: disable call to MiniSSDPd when -m option is used
fixes #269
2018-02-22 15:58:25 +01:00
Thomas Bernard 15cd905f6f => 2017
also http://miniupnp.tuxfamily.org => HTTPS
2017-05-26 17:27:20 +02:00
Darexon 2c262a8793 AddPortMapping() now returns an error code 2017-02-15 00:01:41 -06:00
Yann GARRAS 3f0bcbf7b5 RemoveRedirect() now return an error code
fixes #210
2016-09-23 17:22:45 +02:00
Thomas Bernard a4916a4c94 SetRedirectAndTest() now return an error code
fixes #210
2016-09-22 22:02:00 +02:00
Thomas Bernard 2808e5c1c8 upnpc.c: do not use uninitialized bytes 2016-01-22 16:52:18 +01:00
Thomas Bernard cf9a2940e6 2015=>2016 2016-01-22 15:22:23 +01:00
Thomas Bernard f407d5a7ee formatting 2015-10-08 17:48:04 +02:00
Thomas Bernard d4af610c51 Merge branch 'master' into local_port
Conflicts:
	miniupnpc/miniupnpc.c
	miniupnpc/miniupnpc.h
	miniupnpc/miniupnpcmodule.c
	miniupnpc/upnpc.c
2015-10-08 17:42:45 +02:00
Thomas Bernard be410fded8 2014 => 2015 2015-10-08 17:01:12 +02:00
Thomas Bernard 1da63faa4f miniupnpc: add ttl argument to upnpDiscover() functions
increments API_VERSION to 14
2015-07-23 22:44:37 +02:00
Nevo Hed 94a5af0c15 Allow user to explicitly specify local (source) port
See https://github.com/miniupnp/miniupnp/issues/119

- Replace the sameport parameter to the upnpDiscover* functions
- Added constants UPNP_LOCAL_PORT_ANY(0) & UPNP_LOCAL_PORT_SAME(1).  The
  value "1" was chosen for presumed backwards compatability with the
  previous "sameport" parameter (assuming usesr would have set to 1 if
  they wanted same port)
- Can be specified with "-z" to the test programs "upnpc" & "pymoduletest.py"
2015-05-12 19:05:48 -04:00
Thomas Bernard c7943b6db3 upnpc.c: output Version on the terminal
fixes #115
2015-04-30 10:31:53 +02:00
Thomas Bernard 1e7d13f34f improve -r command
fixes #104
2015-04-24 22:55:37 +02:00
sanderjo a0614ecfb3 add optional parameter <external_port> to option -r 2015-04-24 19:24:20 +02:00
Thomas Bernard 3875d61c9e miniupnpc/upnpc.c: avoid printing imaginary error when using -u 2015-01-01 19:40:44 +01:00
Thomas Bernard 3a3072ee8c miniupnpc/upnpc.c: call WSACleanup() 2014-12-01 10:33:00 +01:00
Thomas Bernard 06bf746cc2 miniupnpc: remove bsdqueue.h 2014-11-01 11:41:31 +01:00
Thomas Bernard 0436d03757 miniupnpc/upnpc.c: use remoteHost arg of DeletePortMapping 2014-09-11 16:31:36 +02:00
Arran Cudbard-Bell 0490d16221 Don't print garbage values on failure 2014-05-13 21:50:16 +01:00
Arran Cudbard-Bell b9362f32a7 Add support for IGD2 AddAnyPortMapping and DeletePortMappingRange
Added python bindings for both AddAnyPortMapping and DeletePortMappingRange
2014-05-13 21:50:07 +01:00
Arran Cudbard-Bell be9584d156 Fix formatting in areas the next commit will touch 2014-05-13 21:49:51 +01:00
Thomas Bernard 8ffaa91b2d upnpc.c: 2013 -> 2014 2014-02-05 18:32:47 +01:00
Thomas Bernard 28cab3e219 miniupnpc: added argument remoteHost to UPNP_GetSpecificPortMappingEntry()
increment API_VERSION to 10
2014-01-31 14:32:00 +01:00
Thomas Bernard b6ecae893c upnpc.c: --help and -h arguments
fixes #037
2013-12-09 10:25:27 +01:00
Thomas Bernard 49f38310fa miniupnpc: prepare version 1.8 ! 2013-02-06 14:57:49 +01:00
Thomas Bernard 18ea17b95e Add -e option to upnpc program (set description for port mappings) 2012-08-30 12:38:27 +02:00
Thomas Bernard 18c973d9fc upnpc: yead 2012 in (c) :) 2012-06-28 21:02:37 +02:00
Thomas Bernard 8c22bf187d miniupnpc: More error return checks in upnpc.c 2012-06-24 00:44:22 +02:00
Thomas Bernard 83032a62ca Fix crash if -A protocol argument is neither numeric, neither TCP or UDP 2012-05-08 23:05:21 +02:00
Thomas Bernard 825d3bd89f Allow to specify protocol with TCP or UDP for -A option 2012-04-20 16:44:03 +02:00
Thomas Bernard 175bd2894f Added -ansi flag to compilation, and fixed C++ comments to ANSI C comments 2012-04-10 00:08:53 +02:00
Shawn Landen 6e14420ab1 remove trailing whitespace from miniupnpc 2012-02-29 17:51:24 -08:00
Thomas Bernard 35e25ab375 Replaced WIN32 macro by _WIN32 2012-01-21 14:38:38 +01:00
Thomas Bernard 3917487cb4 The multicast interface can now be specified by name with IPv4 2012-01-07 11:40:50 +01:00
Thomas Bernard e6a2c788f4 added header to Port Mappings list in upnpc.c 2012-01-07 11:37:16 +01:00
Thomas Bernard c183a72c46 Added miniupnpc 2011-09-27 22:25:35 +02:00