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,\ ...@@ -17,7 +17,6 @@ $(eval $(call gb_UnpackedTarball_add_files,neon,src,\
$(eval $(call gb_UnpackedTarball_set_patchlevel,neon,0)) $(eval $(call gb_UnpackedTarball_set_patchlevel,neon,0))
ifeq ($(OS),WNT)
$(eval $(call gb_UnpackedTarball_add_patches,neon,\ $(eval $(call gb_UnpackedTarball_add_patches,neon,\
external/neon/neon.patch \ external/neon/neon.patch \
external/neon/neon_ne_set_request_flag.patch \ external/neon/neon_ne_set_request_flag.patch \
...@@ -26,14 +25,5 @@ $(eval $(call gb_UnpackedTarball_add_patches,neon,\ ...@@ -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_token_on_if.patch \
external/neon/neon_fix_lock_timeout_windows.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: # vim: set noet sw=4 ts=4:
--- src.origin/ne_locks.c 2007-02-05 11:09:27.000000000 +0100 --- 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 +++ src/ne_locks.c 2015-11-11 16:12:11.236849082 +0100
@@ -428,10 +428,20 @@ @@ -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) { if (ne_strcasecmp(timeout, "infinite") == 0) {
return NE_TIMEOUT_INFINITE; return NE_TIMEOUT_INFINITE;
} else if (strncasecmp(timeout, "Second-", 7) == 0) { } else if (strncasecmp(timeout, "Second-", 7) == 0) {
- long to = strtol(timeout+7, NULL, 10); - long to = strtol(timeout+7, NULL, 10);
- if (to == LONG_MIN || to == LONG_MAX) - if (to == LONG_MIN || to == LONG_MAX)
- return NE_TIMEOUT_INVALID; + // according RFC 4918 the value used for lock timeout is unsigned 32 bit
- return to; + // see: <http://tools.ietf.org/html/rfc4918#section-10.7>
+ // according RFC 4918 the value used for lock timeout is unsigned 32 bit + // adapt it to the 'long' used internally by neon instead
+ // see: <http://tools.ietf.org/html/rfc4918#section-10.7> + errno = 0;
+ // adapt it to the 'long' used internally by neon instead + unsigned long to1 = strtoul(timeout+7, NULL, 10);
+ // LONG_MAX means around 68 years. + if (to1 == ULONG_MAX && errno == ERANGE)
+ unsigned long to1 = strtoul(timeout+7, NULL, 10); return NE_TIMEOUT_INVALID;
+ long to; + NE_DEBUG(NE_DBG_LOCKS, "Parsed lock timeout: %lu\n", to1);
+ if (to1 >= LONG_MAX) + long to;
+ to = LONG_MAX - 1; + // LONG_MAX means around 68 years,
+ else + // more than enough for practical use
+ to = (long)to1; + if (to1 > LONG_MAX)
+ NE_DEBUG(NE_DBG_LOCKS, "Received lock timeout: %ld\n", to); + return LONG_MAX;
+ if (to == LONG_MIN || to == LONG_MAX) + else
+ return NE_TIMEOUT_INVALID; + to = (long)to1;
+ return to; return to;
} else { } else {
return NE_TIMEOUT_INVALID; 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