• Thore Sommer's avatar
    dm ima: fix wrong length calculation for no_data string · 118f31b4
    Thore Sommer authored
    All entries measured by dm ima are prefixed by a version string
    (dm_version=N.N.N). When there is no data to measure, the entire buffer is
    overwritten with a string containing the version string again and the
    length of that string is added to the length of the version string.
    The new length is now wrong because it contains the version string twice.
    
    This caused entries like this:
    dm_version=4.45.0;name=test,uuid=test;table_clear=no_data; \
    \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 \
    current_device_capacity=204808;
    Signed-off-by: default avatarThore Sommer <public@thson.de>
    Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
    118f31b4
dm-ima.c 20.6 KB