aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2008-01-17 02:14:45 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2008-01-17 02:14:45 +0000
commitfa2f1091fad2d4a376c6ab2bb834712fb9610771 (patch)
treee055e03bf6b2856b5bcd80e6d281bdf00b1a0166
parentbdb13a50c28736df047a0b0660e212ec49baf9d1 (diff)
downloadpaludis-fa2f1091fad2d4a376c6ab2bb834712fb9610771.tar.gz
paludis-fa2f1091fad2d4a376c6ab2bb834712fb9610771.tar.xz
Fix segfault on excessively short ebuilds.
-rw-r--r--paludis/repositories/e/qa/header.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/paludis/repositories/e/qa/header.cc b/paludis/repositories/e/qa/header.cc
index 55e5f06..3060b73 100644
--- a/paludis/repositories/e/qa/header.cc
+++ b/paludis/repositories/e/qa/header.cc
@@ -47,20 +47,20 @@ paludis::erepository::header_check(
do
{
- if (! r_licence.search(lines[1]))
+ if (! (lines.size() > 1 && r_licence.search(lines[1])))
reporter.message(QAMessage(entry, qaml_normal, name, "Wrong licence statement in line 2")
.with_associated_id(id));
std::string year;
// Check line 3 before line 1 to extract date of last commit
- if (r_cvs_empty_header.search(lines[2]))
+ if (lines.size() > 2 && r_cvs_empty_header.search(lines[2]))
{
time_t now(time(NULL));
struct tm now_struct;
year = stringify(localtime_r(&now, &now_struct)->tm_year + 1900);
}
- else if (r_cvs_header.search(lines[2]))
+ else if (lines.size() > 2 && r_cvs_header.search(lines[2]))
year = r_cvs_header[0];
else
{
@@ -72,7 +72,7 @@ paludis::erepository::header_check(
Log::get_instance()->message(ll_debug, lc_context, "Expected copyright year is " + year);
pcrepp::Pcre::Pcre r_copyright("^# Copyright ((1999|200\\d)-)?" + year + " Gentoo Foundation$");
- if (! r_copyright.search(lines[0]))
+ if (! (lines.size() > 0 && r_copyright.search(lines[0])))
reporter.message(QAMessage(entry, qaml_normal, name, "Wrong copyright assignment in line 1, possibly date related")
.with_associated_id(id));