if(registry.loaders.empty())
throw unsupported_image_format("no loaders");
- vector<char> sig_buf(registry.loaders.back()->get_signature_size());
- unsigned sig_len = io.read(&sig_buf[0], sig_buf.size());
- string signature(sig_buf.begin(), sig_buf.end());
+ string signature(registry.loaders.back()->get_signature_size(), 0);
+ unsigned sig_len = io.read(&signature[0], signature.size());
ImageLoader *loader = 0;
for(list<RegisterBase *>::const_iterator i=registry.loaders.begin(); (!loader && i!=registry.loaders.end()); ++i)
{
string sig_hex;
for(unsigned i=0; i<sig_len; ++i)
- append(sig_hex, " ", format("%02X", static_cast<unsigned char>(sig_buf[i])));
+ append(sig_hex, " ", format("%02X", static_cast<unsigned char>(signature[i])));
throw unsupported_image_format(sig_hex);
}