Kaydet (Commit) bd661bde authored tarafından Giuseppe Castagno's avatar Giuseppe Castagno Kaydeden (comit) Stephan Bergmann

Related tdf#90249 A reinterpretation of the previous fix...

...which lives in commit f75c1966.

The previous fix didn't address correctly all the LO versions
available (32 and 64 bit for all the platforms), it's needed
in all supported platforms.

Change-Id: I24728e0a86df3cc2b2073a8487b63c6739596feb
Reviewed-on: https://gerrit.libreoffice.org/19922Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst 25f6ef3d
......@@ -17,7 +17,6 @@ $(eval $(call gb_UnpackedTarball_add_files,neon,src,\
$(eval $(call gb_UnpackedTarball_set_patchlevel,neon,0))
ifeq ($(OS),WNT)
$(eval $(call gb_UnpackedTarball_add_patches,neon,\
external/neon/neon.patch \
external/neon/neon_ne_set_request_flag.patch \
......@@ -26,14 +25,5 @@ $(eval $(call gb_UnpackedTarball_add_patches,neon,\
external/neon/neon_fix_lock_token_on_if.patch \
external/neon/neon_fix_lock_timeout_windows.patch \
))
else
$(eval $(call gb_UnpackedTarball_add_patches,neon,\
external/neon/neon.patch \
external/neon/neon_ne_set_request_flag.patch \
external/neon/neon_with_gnutls.patch \
external/neon/ubsan.patch \
external/neon/neon_fix_lock_token_on_if.patch \
))
endif
# vim: set noet sw=4 ts=4:
--- src.origin/ne_locks.c 2007-02-05 11:09:27.000000000 +0100
+++ src/ne_locks.c 2015-11-08 17:21:52.968561488 +0100
@@ -428,10 +428,20 @@
+++ src/ne_locks.c 2015-11-11 16:12:11.236849082 +0100
@@ -33,6 +33,10 @@
#include <limits.h>
#endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+
#include <ctype.h> /* for isdigit() */
#include "ne_alloc.h"
@@ -428,9 +432,21 @@
if (ne_strcasecmp(timeout, "infinite") == 0) {
return NE_TIMEOUT_INFINITE;
} else if (strncasecmp(timeout, "Second-", 7) == 0) {
- long to = strtol(timeout+7, NULL, 10);
- if (to == LONG_MIN || to == LONG_MAX)
- return NE_TIMEOUT_INVALID;
- return to;
+ // according RFC 4918 the value used for lock timeout is unsigned 32 bit
+ // see: <http://tools.ietf.org/html/rfc4918#section-10.7>
+ // adapt it to the 'long' used internally by neon instead
+ // LONG_MAX means around 68 years.
+ unsigned long to1 = strtoul(timeout+7, NULL, 10);
+ long to;
+ if (to1 >= LONG_MAX)
+ to = LONG_MAX - 1;
+ else
+ to = (long)to1;
+ NE_DEBUG(NE_DBG_LOCKS, "Received lock timeout: %ld\n", to);
+ if (to == LONG_MIN || to == LONG_MAX)
+ return NE_TIMEOUT_INVALID;
+ return to;
+ // according RFC 4918 the value used for lock timeout is unsigned 32 bit
+ // see: <http://tools.ietf.org/html/rfc4918#section-10.7>
+ // adapt it to the 'long' used internally by neon instead
+ errno = 0;
+ unsigned long to1 = strtoul(timeout+7, NULL, 10);
+ if (to1 == ULONG_MAX && errno == ERANGE)
return NE_TIMEOUT_INVALID;
+ NE_DEBUG(NE_DBG_LOCKS, "Parsed lock timeout: %lu\n", to1);
+ long to;
+ // LONG_MAX means around 68 years,
+ // more than enough for practical use
+ if (to1 > LONG_MAX)
+ return LONG_MAX;
+ else
+ to = (long)to1;
return to;
} else {
return NE_TIMEOUT_INVALID;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment