From owner-svn-src-stable-11@freebsd.org Sat Feb 10 01:52:58 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CC113F15842; Sat, 10 Feb 2018 01:52:58 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7EC8285BFE; Sat, 10 Feb 2018 01:52:58 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 79689566F; Sat, 10 Feb 2018 01:52:58 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1A1qwJx028838; Sat, 10 Feb 2018 01:52:58 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1A1qwE9028836; Sat, 10 Feb 2018 01:52:58 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802100152.w1A1qwE9028836@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 10 Feb 2018 01:52:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329098 - stable/11/lib/libstand X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/lib/libstand X-SVN-Commit-Revision: 329098 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Feb 2018 01:52:59 -0000 Author: kevans Date: Sat Feb 10 01:52:58 2018 New Revision: 329098 URL: https://svnweb.freebsd.org/changeset/base/329098 Log: MFC libstand catch-up: r305116,306534,306538,306552,306638 r305116: recvtftp() is broken for large files, report file size r306534: cd9660_open should check for padding r306538: cstyle fix of cd9660_open in libstand r306552: Fix remaining cstyle issues in libstand/cd9660.c r306638: Fix remaining bugs in libstand/cd9660.c reported by Bruce Evans. PR: 200500 Modified: stable/11/lib/libstand/cd9660.c stable/11/lib/libstand/tftp.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libstand/cd9660.c ============================================================================== --- stable/11/lib/libstand/cd9660.c Sat Feb 10 01:09:22 2018 (r329097) +++ stable/11/lib/libstand/cd9660.c Sat Feb 10 01:52:58 2018 (r329098) @@ -353,6 +353,12 @@ cd9660_open(const char *path, struct open_file *f) dp = (struct iso_directory_record *) ((char *) dp + isonum_711(dp->length)); + /* If the new block has zero length, it is padding. */ + if (isonum_711(dp->length) == 0) { + /* Skip to next block, if any. */ + off = boff * ISO_DEFAULT_BLOCK_SIZE; + continue; + } off += isonum_711(dp->length); } if (off >= dsize) { Modified: stable/11/lib/libstand/tftp.c ============================================================================== --- stable/11/lib/libstand/tftp.c Sat Feb 10 01:09:22 2018 (r329097) +++ stable/11/lib/libstand/tftp.c Sat Feb 10 01:52:58 2018 (r329098) @@ -200,7 +200,7 @@ recvtftp(struct tftp_handle *h, void *pkt, ssize_t len case DATA: { int got; - if (htons(t->th_block) != d->xid) { + if (htons(t->th_block) != (u_short) d->xid) { /* * Expected block? */ @@ -563,7 +563,7 @@ tftp_stat(struct open_file *f, struct stat *sb) sb->st_nlink = 1; sb->st_uid = 0; sb->st_gid = 0; - sb->st_size = -1; + sb->st_size = (off_t) tftpfile->tftp_tsize; return (0); } @@ -734,6 +734,8 @@ tftp_parse_oack(struct tftp_handle *h, char *buf, size } else if (strcasecmp(tftp_options[i], "tsize") == 0) { if (i + 1 < option_idx) tsize = strtol(tftp_options[i + 1], (char **)NULL, 10); + if (tsize != 0) + h->tftp_tsize = tsize; } else { /* Do not allow any options we did not expect to be ACKed. */ printf("unexpected tftp option '%s'\n", tftp_options[i]);