void receive_mountsources(int sockfd)
{
	char *mount_fds, *endp;
	long new_fd;

	// This env var must be a json array of ints.
	mount_fds = getenv("_LIBCONTAINER_MOUNT_FDS");

	if (mount_fds[0] != '[') {
		bail("malformed _LIBCONTAINER_MOUNT_FDS env var: missing '['");
	}
	mount_fds++;

	for (endp = mount_fds; *endp != ']'; mount_fds = endp + 1) {
		new_fd = strtol(mount_fds, &endp, 10);
		if (endp == mount_fds) {
			bail("malformed _LIBCONTAINER_MOUNT_FDS env var: not a number");
		}
		if (*endp == '\0') {
			bail("malformed _LIBCONTAINER_MOUNT_FDS env var: missing ]");
		}
		// The list contains -1 when no fd is needed. Ignore them.
		if (new_fd == -1) {
			continue;
		}

		if (new_fd == LONG_MAX || new_fd < 0 || new_fd > INT_MAX) {
			bail("malformed _LIBCONTAINER_MOUNT_FDS env var: fds out of range");
		}

		receive_fd(sockfd, new_fd);
	}
}
The software performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control.