fix entries having garbage after their name

This commit is contained in:
martravi 2020-03-22 20:42:17 +01:00 committed by GitHub
parent 4750f06e39
commit eda8a4ef3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1227,6 +1227,10 @@ quint16 NandBin::CreateNode( const QString &name, quint32 uid, quint16 gid, quin
QByteArray n = name.toLatin1(); QByteArray n = name.toLatin1();
n.resize( 12 ); n.resize( 12 );
for(int j = name.size(); j < 12; j++) //zerofill from last character to the last byte
{
n[j] = 0x00;
}
//qDebug() << "will add entry for" << n << "at" << hex << i; //qDebug() << "will add entry for" << n << "at" << hex << i;
memcpy( &fsts[ i ].filename, n.data(), 12 ); memcpy( &fsts[ i ].filename, n.data(), 12 );
fsts[ i ].attr = attr; fsts[ i ].attr = attr;