Source-Changes-HG archive

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

[src/trunk]: src/sys/fs/hfs fs/hfs: Avoid undefined pointer arith in hfslib_r...



details:   https://anonhg.NetBSD.org/src/rev/7618a46d771a
branches:  trunk
changeset: 373804:7618a46d771a
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Mar 01 16:21:26 2023 +0000

description:
fs/hfs: Avoid undefined pointer arith in hfslib_reada_node_offsets.

XXX pullup-8
XXX pullup-9
XXX pullup-10

diffstat:

 sys/fs/hfs/libhfs.c |  8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diffs (33 lines):

diff -r 536cfd9a5ab5 -r 7618a46d771a sys/fs/hfs/libhfs.c
--- a/sys/fs/hfs/libhfs.c       Wed Mar 01 16:21:14 2023 +0000
+++ b/sys/fs/hfs/libhfs.c       Wed Mar 01 16:21:26 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: libhfs.c,v 1.16 2023/03/01 16:21:14 riastradh Exp $    */
+/*     $NetBSD: libhfs.c,v 1.17 2023/03/01 16:21:26 riastradh Exp $    */
 
 /*-
  * Copyright (c) 2005, 2007 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: libhfs.c,v 1.16 2023/03/01 16:21:14 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: libhfs.c,v 1.17 2023/03/01 16:21:26 riastradh Exp $");
 
 #include "libhfs.h"
 
@@ -1582,13 +1582,11 @@
         * offset=14, we know this is the last offset. In this way, we don't need
         * to know the number of records beforehand.
         */
-       out_offset_array--;
        do {
                if (numrecords-- == 0)
                        return 0;
-               out_offset_array++;
                *out_offset_array = be16tohp(&ptr);
-       } while (*out_offset_array != (uint16_t)14);
+       } while (*out_offset_array++ != (uint16_t)14);
 
        return ((uint8_t*)ptr - (uint8_t*)in_bytes);
 }



Home | Main Index | Thread Index | Old Index