Correctly initialize string in core/device.cpp

When initializing a string with multiple characters, first
comes the length, then the size. Not the other way around.

Fixes #4127.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-03-11 07:30:02 +01:00 committed by Michael Keller
parent 8b5812bc2c
commit c7a929a8a8

View file

@ -296,7 +296,7 @@ std::string fp_get_data(struct fingerprint_table *table, unsigned int i)
if (!table || i >= table->fingerprints.size())
return std::string();
struct fingerprint_record *fpr = &table->fingerprints[i];
std::string res(' ', fpr->fsize * 2);
std::string res(fpr->fsize * 2, ' ');
for (unsigned int i = 0; i < fpr->fsize; ++i) {
res[2 * i] = to_hex_digit((fpr->raw_data[i] >> 4) & 0xf);
res[2 * i + 1] = to_hex_digit(fpr->raw_data[i] & 0xf);