Skip to content

Commit f783b3b

Browse files
author
mdb_services2
committed
Correct HACK logic for Stat/Transfer
1 parent 104ba03 commit f783b3b

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/sas/readstat_sas7bdat_read.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -979,12 +979,11 @@ static readstat_error_t sas7bdat_parse_page_pass2(const char *page, size_t page_
979979
if ((page_type & SAS_PAGE_TYPE_MASK) == SAS_PAGE_TYPE_MIX) {
980980
/* HACK - this is supposed to obey 8-byte boundaries but
981981
* some files created by Stat/Transfer don't. So verify that the
982-
* padding is { 0, 0, 0, 0 } or { ' ', ' ', ' ', ' ' } (or that
982+
* padding is { 0, 0, 0, 0 } or { ' ', ' ', ' ', ' ' } (and that
983983
* the file is not from Stat/Transfer) before skipping it */
984984
if ((shp-page)%8 == 4 && shp + 4 <= page + page_size &&
985-
(*(uint32_t *)shp == 0x00000000 ||
986-
*(uint32_t *)shp == 0x20202020 ||
987-
ctx->vendor != READSTAT_VENDOR_STAT_TRANSFER)) {
985+
(*(uint32_t *)shp == 0x00000000 || *(uint32_t *)shp == 0x20202020) &&
986+
ctx->vendor != READSTAT_VENDOR_STAT_TRANSFER) {
988987
data = shp + 4;
989988
} else {
990989
data = shp;

0 commit comments

Comments
 (0)