diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2008-01-24 12:23:36 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2008-01-24 12:23:36 +0000 |
commit | 2bf42661c229ba8669629455704cf2dfa25f312d (patch) | |
tree | 22546e814255124568c3d8c6d2579312bf9aa37d /include/assert.h | |
parent | 573412fd7b9a8fe8e8a528839f7c9f91d9ca8f59 (diff) |
"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 'include/assert.h')
0 files changed, 0 insertions, 0 deletions