1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

tests: don't crash if checked string is shorter

Not really sure what is this testing - just avoid coredump if
the test cannot happen since the index would too high.
This commit is contained in:
Zdenek Kabelac 2015-02-12 10:39:37 +01:00
parent b1002e98e0
commit 739b751046

View File

@ -958,7 +958,7 @@ struct Main {
flav != options.flavours.end(); ++flav ) {
for ( Listing::iterator i = l.begin(); i != l.end(); ++i ) {
if ( i->substr( i->length() - 3, i->length() ) != ".sh" )
if ( ( i->length() < 3 ) || ( i->substr( i->length() - 3, i->length() ) != ".sh" ) )
continue;
if ( i->substr( 0, 4 ) == "lib/" )
continue;