Skip to content
Snippets Groups Projects
Commit 34c2a314 authored by Emmanuel Milou's avatar Emmanuel Milou
Browse files

Bug fix - Directories scan

The daemon crashed when a file with a filename too short was in the directory.
Add length check and extension check before doing anything
parent 97f531d6
No related branches found
No related tags found
No related merge requests found
......@@ -272,6 +272,16 @@ CodecDescriptor::seemsValid( std::string lib)
std::string begin = SFL_CODEC_VALID_PREFIX;
std::string end = SFL_CODEC_VALID_EXTEN;
// First : check the length of the file name.
// If it is shorter than begin.length() + end.length() , not a SFL shared library
if( lib.length() <= begin.length() + end.length() )
return false;
// Second: check the extension of the file name.
// If it is different than SFL_CODEC_VALID_EXTEN , not a SFL shared library
if( lib.substr( lib.length() - end.length() , lib.length()) != end )
return false;
#ifdef BUILD_SPEEX
// Nothing special
#else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment