Skip to content

Commit 68ad236

Browse files
authored
Merge pull request #92 from SolarRepublic/fix/plaintext-attr-padding
fix: only pad encrypted attributes
2 parents 95428dd + ca453e9 commit 68ad236

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

packages/utils/src/padding.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,13 @@ where
3030
data
3131
});
3232
for attribute in &mut response.attributes {
33-
// Safety: These two are safe because we know the characters that
34-
// `space_pad` appends are valid UTF-8
35-
unsafe { space_pad(attribute.key.as_mut_vec(), block_size) };
36-
unsafe { space_pad(attribute.value.as_mut_vec(), block_size) };
33+
// do not pad plaintext attributes
34+
if attribute.encrypted {
35+
// Safety: These two are safe because we know the characters that
36+
// `space_pad` appends are valid UTF-8
37+
unsafe { space_pad(attribute.key.as_mut_vec(), block_size) };
38+
unsafe { space_pad(attribute.value.as_mut_vec(), block_size) };
39+
}
3740
}
3841
response
3942
})

0 commit comments

Comments
 (0)