From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 8AA05138202 for ; Fri, 4 Oct 2013 19:07:58 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 187A4E09EF; Fri, 4 Oct 2013 19:07:58 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 7F65AE09EF for ; Fri, 4 Oct 2013 19:07:57 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 95DDD33EE76 for ; Fri, 4 Oct 2013 19:07:56 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 401D9E545D for ; Fri, 4 Oct 2013 19:07:55 +0000 (UTC) From: "William Hubbs" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "William Hubbs" Message-ID: <1380913322.03c67bcc2727a3e61a168c7dfac98a3dd49c7d79.williamh@OpenRC> Subject: [gentoo-commits] proj/openrc:master commit in: src/librc/ X-VCS-Repository: proj/openrc X-VCS-Files: src/librc/librc.c X-VCS-Directories: src/librc/ X-VCS-Committer: williamh X-VCS-Committer-Name: William Hubbs X-VCS-Revision: 03c67bcc2727a3e61a168c7dfac98a3dd49c7d79 X-VCS-Branch: master Date: Fri, 4 Oct 2013 19:07:55 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 16446893-99e6-4c49-b625-c363b0f466fa X-Archives-Hash: 346b7bb990e7a58393968b8ba9b89a74 commit: 03c67bcc2727a3e61a168c7dfac98a3dd49c7d79 Author: Natanael Copa gmail com> AuthorDate: Thu Sep 26 08:17:07 2013 +0000 Commit: William Hubbs gentoo org> CommitDate: Fri Oct 4 19:02:02 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=03c67bcc librc: fix a read off-by-one bug We should first check if we are within bounds and then read rather than the opposite. This makes valgrind happy. Signed-off-by: Natanael Copa alpinelinux.org> --- src/librc/librc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librc/librc.c b/src/librc/librc.c index 839fcd8..cb4ce63 100644 --- a/src/librc/librc.c +++ b/src/librc/librc.c @@ -193,7 +193,7 @@ file_regex(const char *file, const char *regex) str += strlen(str) + 1; /* len is the size of allocated buffer and we don't want call regexec BUFSIZE times. find next str */ - while (*str == '\0' && str < line + len) + while (str < line + len && *str == '\0') str++; } while (str < line + len); }