Skip to content

Commit e1a7457

Browse files
committed
MountTag hashing using ":" instead of "\0" separator
Using \0 as a separator makes the hash hard to reproduce in environments that do not allow NUL bytes in strings. This affects, for example, NixOS configurations that generate filesystem mount definitions directly rather than using cloud-init. Signed-off-by: Alain Lehmann <alain.lehmann@gmail.com>
1 parent 2d4314e commit e1a7457

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

pkg/limayaml/defaults.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ func MACAddress(uniqueID string) string {
9595
// MountTag generates a stable mount tag from location and mountPoint.
9696
// Both paths are hashed to handle the same location mounted to multiple mount points.
9797
func MountTag(location, mountPoint string) string {
98-
sha := sha256.Sum256([]byte(location + "\x00" + mountPoint))
98+
sha := sha256.Sum256([]byte(location + ":" + mountPoint))
9999
return fmt.Sprintf("lima-%x", sha[0:8])
100100
}
101101

0 commit comments

Comments
 (0)