Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/lib/libsa fix damage in error handling crept in in 1.4
details: https://anonhg.NetBSD.org/src/rev/931db40ffa40
branches: trunk
changeset: 474587:931db40ffa40
user: drochner <drochner%NetBSD.org@localhost>
date: Mon Jul 12 12:34:57 1999 +0000
description:
fix damage in error handling crept in in 1.4
diffstat:
sys/lib/libsa/tftp.c | 15 ++++++---------
1 files changed, 6 insertions(+), 9 deletions(-)
diffs (45 lines):
diff -r 38195fd5711b -r 931db40ffa40 sys/lib/libsa/tftp.c
--- a/sys/lib/libsa/tftp.c Mon Jul 12 09:33:59 1999 +0000
+++ b/sys/lib/libsa/tftp.c Mon Jul 12 12:34:57 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tftp.c,v 1.6 1999/03/31 01:50:26 cgd Exp $ */
+/* $NetBSD: tftp.c,v 1.7 1999/07/12 12:34:57 drochner Exp $ */
/*
* Copyright (c) 1996
@@ -116,20 +116,19 @@
register size_t len;
time_t tleft;
{
+ ssize_t n;
struct tftphdr *t;
errno = 0;
- len = readudp(d, pkt, len, tleft);
+ n = readudp(d, pkt, len, tleft);
- if (len < 4)
+ if (n < 4)
return (-1);
t = (struct tftphdr *) pkt;
switch (ntohs(t->th_opcode)) {
- case DATA: {
- int got;
-
+ case DATA:
if (htons(t->th_block) != d->xid) {
/*
* Expected block?
@@ -144,9 +143,7 @@
uh = (struct udphdr *) pkt - 1;
d->destport = uh->uh_sport;
} /* else check uh_sport has not changed??? */
- got = len - (t->th_data - (char *) t);
- return got;
- }
+ return (n - (t->th_data - (char *)t));
case ERROR:
if ((unsigned) ntohs(t->th_code) >= 8) {
printf("illegal tftp error %d\n", ntohs(t->th_code));
Home |
Main Index |
Thread Index |
Old Index