Package: liblockfile-bin
Version: 1.09-6
Severity: normal
Tags: patch
dotlockfile -r -1
doesn't work on x86_64 (haven't tried other archs) - instead of retrying
indefinitely, it never retries (behaves like "-r 0").
This seems to be due to an integer overflow, since:
int tries = retries + 1;
so if retries is already INT_MAX then adding one to it will cause it to
overfow.
-- System Information:
Debian Release: 8.4
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 3.16.0-4-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages liblockfile-bin depends on:
ii libc6 2.19-18+deb8u4
liblockfile-bin recommends no packages.
liblockfile-bin suggests no packages.
-- no debconf information
--- liblockfile-1.09/dotlockfile.c.orig 2011-07-04 17:26:59.000000000 +0100
+++ liblockfile-1.09/dotlockfile.c 2016-04-27 15:46:31.302112422 +0100
@@ -31,6 +31,7 @@
#include <errno.h>
#include <maillock.h>
#include <lockfile.h>
+#include <limits.h>
#ifdef HAVE_GETOPT_H
#include <getopt.h>
@@ -244,8 +245,10 @@
return L_ERROR;
}
if (retries == -1) {
- /* 4000 years */
- retries = 2147483647;
+ /* 4000 years with 32bit signed int. *
+ * Prevent overflow when we later set *
+ * tries to retries plus 1 */
+ retries = INT_MAX - 1;
}
break;
case 'm':