svn commit: r329098 - stable/11/lib/libstand
Kyle Evans
kevans at FreeBSD.org
Sat Feb 10 01:52:59 UTC 2018
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]);
More information about the svn-src-stable-11
mailing list