diff options
author | 2008-01-24 12:23:35 +0000 | |
---|---|---|
committer | 2008-01-24 12:23:35 +0000 | |
commit | 7318b25ae60c0ead52bab25abb34bb2fc6ed458a (patch) | |
tree | c4b465a347d6e448239e1f93f32de96fe7ae2cb1 /sys/dev/softraid.c | |
parent | "read(..., ..., sizeof Y) < sizeof Y" is a dangerous idiom because it (diff) | |
download | wireguard-openbsd-7318b25ae60c0ead52bab25abb34bb2fc6ed458a.tar.xz wireguard-openbsd-7318b25ae60c0ead52bab25abb34bb2fc6ed458a.zip |
"read(..., ..., sizeof Y) < sizeof Y" is a dangerous idiom because it
does an unsigned comparison and read() can return -1. Use '!=' instead
of '<' since read() can't return more than 'sizeof Y'. Not perfect
(that would require a separate test for -1) but a very common usage.
Do the same for a write(), and a couple of read() calls which are
probably ok but why be inconsistant?
This, as the last couple of commits, found by ian@ as a result of
poking around in fsck_msdos() when his new iPod had problems vs
OpenBSD.
Concept reviewed by miod@, beck@, otto@ and ian@.
Diffstat (limited to 'sys/dev/softraid.c')
0 files changed, 0 insertions, 0 deletions