Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin Fix endian issues with fsck_udf/newfs_udf/makefs



details:   https://anonhg.NetBSD.org/src/rev/1f240c508af7
branches:  trunk
changeset: 365740:1f240c508af7
user:      reinoud <reinoud%NetBSD.org@localhost>
date:      Fri Apr 22 20:56:46 2022 +0000

description:
Fix endian issues with fsck_udf/newfs_udf/makefs

diffstat:

 sbin/fsck_udf/main.c      |  10 +++++-----
 sbin/newfs_udf/udf_core.c |   6 +++---
 2 files changed, 8 insertions(+), 8 deletions(-)

diffs (70 lines):

diff -r 468db842c72b -r 1f240c508af7 sbin/fsck_udf/main.c
--- a/sbin/fsck_udf/main.c      Fri Apr 22 19:21:08 2022 +0000
+++ b/sbin/fsck_udf/main.c      Fri Apr 22 20:56:46 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.7 2022/04/22 19:21:08 reinoud Exp $ */
+/*     $NetBSD: main.c,v 1.8 2022/04/22 20:56:46 reinoud Exp $ */
 
 /*
  * Copyright (c) 2022 Reinoud Zandijk
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: main.c,v 1.7 2022/04/22 19:21:08 reinoud Exp $");
+__RCSID("$NetBSD: main.c,v 1.8 2022/04/22 20:56:46 reinoud Exp $");
 #endif /* not lint */
 
 #include <stdio.h>
@@ -362,13 +362,13 @@
        /* create one short_ad or one long_ad */
        if (ad_type == UDF_ICB_SHORT_ALLOC) {
                short_adp = (struct short_ad *) bpos;
-               short_adp->len    = udf_rw64(inf_len);
+               short_adp->len    = udf_rw32(inf_len);
                short_adp->lb_num = allocated.loc.lb_num;
                l_ad = sizeof(struct short_ad);
        } else {
                long_adp  = (struct long_ad  *) bpos;
                memcpy(long_adp, &allocated, sizeof(struct long_ad));
-               long_adp->len = udf_rw64(inf_len);
+               long_adp->len = udf_rw32(inf_len);
                l_ad = sizeof(struct long_ad);
        }
        if (id == TAGID_FENTRY)
@@ -2600,7 +2600,7 @@
                         * data file length
                         */
                        context.part_size[log_part] =
-                               udf_rw32(context.meta_file->inf_len) / context.sector_size;
+                               udf_rw64(context.meta_file->inf_len) / context.sector_size;
                        break;
                default:
                        break;
diff -r 468db842c72b -r 1f240c508af7 sbin/newfs_udf/udf_core.c
--- a/sbin/newfs_udf/udf_core.c Fri Apr 22 19:21:08 2022 +0000
+++ b/sbin/newfs_udf/udf_core.c Fri Apr 22 20:56:46 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_core.c,v 1.2 2022/04/09 09:58:11 riastradh Exp $ */
+/* $NetBSD: udf_core.c,v 1.3 2022/04/22 20:56:46 reinoud Exp $ */
 
 /*
  * Copyright (c) 2006, 2008, 2021, 2022 Reinoud Zandijk
@@ -30,7 +30,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: udf_core.c,v 1.2 2022/04/09 09:58:11 riastradh Exp $");
+__RCSID("$NetBSD: udf_core.c,v 1.3 2022/04/22 20:56:46 reinoud Exp $");
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -2024,7 +2024,7 @@
        if (udf_rw16(fid->tag.id) != TAGID_FID)
                errx(1, "internal error, bad tag in %s", __func__);
 
-       size = UDF_FID_SIZE + udf_rw16(fid->l_fi) + udf_rw16(fid->l_iu);
+       size = UDF_FID_SIZE + fid->l_fi + udf_rw16(fid->l_iu);
        size = (size + 3) & ~3;
 
        return size;



Home | Main Index | Thread Index | Old Index