diff options
author | 2014-06-10 09:36:42 +0000 | |
---|---|---|
committer | 2014-06-10 09:36:42 +0000 | |
commit | 4f4b6a40013eec62a2cbba1c60131a875cc660f9 (patch) | |
tree | 253cd3f264c0150461141bde3ec137d12548282a /sys/lib/libsa/tftp.c | |
parent | mop up ifndef KERNEL goo; ok miod (diff) | |
download | wireguard-openbsd-4f4b6a40013eec62a2cbba1c60131a875cc660f9.tar.xz wireguard-openbsd-4f4b6a40013eec62a2cbba1c60131a875cc660f9.zip |
Rearrange the inequality.
Pointed out by LLVM.
tftp.c:331:17: error: comparison of unsigned expression < 0 is always false
From NetBSD
ok miod@
Diffstat (limited to 'sys/lib/libsa/tftp.c')
-rw-r--r-- | sys/lib/libsa/tftp.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/lib/libsa/tftp.c b/sys/lib/libsa/tftp.c index d685be5ee73..3402326f381 100644 --- a/sys/lib/libsa/tftp.c +++ b/sys/lib/libsa/tftp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tftp.c,v 1.4 2014/03/28 01:12:58 guenther Exp $ */ +/* $OpenBSD: tftp.c,v 1.5 2014/06/10 09:36:42 brad Exp $ */ /* $NetBSD: tftp.c,v 1.15 2003/08/18 15:45:29 dsl Exp $ */ /* @@ -327,14 +327,14 @@ tftp_read(struct open_file *f, void *addr, size_t size, size_t *resid) offinblock = tftpfile->off % SEGSIZE; - inbuffer = tftpfile->validsize - offinblock; - if (inbuffer < 0) { + if (offinblock > tftpfile->validsize) { #ifdef DEBUG printf("tftp: invalid offset %d\n", tftpfile->off); #endif return EINVAL; } + inbuffer = tftpfile->validsize - offinblock; count = (size < inbuffer ? size : inbuffer); bcopy(tftpfile->lastdata.t.th_data + offinblock, addr, count); |