* [gentoo-commits] proj/openrc:openrc-0.12.x commit in: src/librc/
@ 2013-10-08 17:10 William Hubbs
0 siblings, 0 replies; 2+ messages in thread
From: William Hubbs @ 2013-10-08 17:10 UTC (permalink / raw
To: gentoo-commits
commit: 5b0f323da983f316dc05e4d3fa73cc75ea0fd0f1
Author: Natanael Copa <natanael.copa <AT> gmail <DOT> com>
AuthorDate: Thu Sep 26 07:59:29 2013 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Tue Oct 8 17:06:09 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=5b0f323d
librc: fix off-by-one bug
We need allocate space for both the added leading '-' and the trailing
'\0'.
Signed-off-by: Natanael Copa <ncopa <AT> alpinelinux.org>
---
src/librc/librc-depend.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/librc/librc-depend.c b/src/librc/librc-depend.c
index ac93716..c9df451 100644
--- a/src/librc/librc-depend.c
+++ b/src/librc/librc-depend.c
@@ -856,7 +856,7 @@ rc_deptree_update(void)
* work for them. This doesn't stop them from being run directly. */
if (sys) {
len = strlen(sys);
- nosys = xmalloc(len + 1);
+ nosys = xmalloc(len + 2);
nosys[0] = '-';
for (i = 0; i < len; i++)
nosys[i + 1] = (char)tolower((unsigned char)sys[i]);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [gentoo-commits] proj/openrc:openrc-0.12.x commit in: src/librc/
@ 2013-10-08 17:10 William Hubbs
0 siblings, 0 replies; 2+ messages in thread
From: William Hubbs @ 2013-10-08 17:10 UTC (permalink / raw
To: gentoo-commits
commit: d86853538ab38f4bb98a69bde9956c1f15332207
Author: Natanael Copa <natanael.copa <AT> gmail <DOT> com>
AuthorDate: Thu Sep 26 08:17:07 2013 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Tue Oct 8 17:06:09 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=d8685353
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 <ncopa <AT> 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 40b975a..28f63f3 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);
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-10-08 17:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-08 17:10 [gentoo-commits] proj/openrc:openrc-0.12.x commit in: src/librc/ William Hubbs
-- strict thread matches above, loose matches on Subject: below --
2013-10-08 17:10 William Hubbs
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox