Skip to content

Commit

Permalink
fix unaligned load
Browse files Browse the repository at this point in the history
  • Loading branch information
xlc committed Oct 23, 2024
1 parent 0ffb781 commit 258a2b7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Networking/Sources/Networking/Connection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public final class Connection<Handler: StreamHandler>: Sendable, ConnectionInfoP
logger.debug("Invalid request length")
return
}
let length = UInt32(littleEndian: lengthData.withUnsafeBytes { $0.load(as: UInt32.self) })
let length = UInt32(littleEndian: lengthData.withUnsafeBytes { $0.loadUnaligned(as: UInt32.self) })
// sanity check for length
// TODO: pick better value
guard length < 1024 * 1024 * 10 else {
Expand Down

0 comments on commit 258a2b7

Please sign in to comment.