Module Name: src
Committed By: riastradh
Date: Wed Mar 1 16:21:26 UTC 2023
Modified Files:
src/sys/fs/hfs: libhfs.c
Log Message:
fs/hfs: Avoid undefined pointer arith in hfslib_reada_node_offsets.
XXX pullup-8
XXX pullup-9
XXX pullup-10
To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/fs/hfs/libhfs.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/fs/hfs/libhfs.c
diff -u src/sys/fs/hfs/libhfs.c:1.16 src/sys/fs/hfs/libhfs.c:1.17
--- src/sys/fs/hfs/libhfs.c:1.16 Wed Mar 1 16:21:14 2023
+++ src/sys/fs/hfs/libhfs.c Wed Mar 1 16:21:26 2023
@@ -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 @@ hfslib_reada_node_offsets(void* in_bytes
* 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);
}