Module Name:    src
Committed By:   kre
Date:           Wed Dec 28 14:32:04 UTC 2022

Modified Files:
        src/lib/libc/string: swab.c

Log Message:
PR lib/57141 - never decrement len without actually performing a STEP.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/lib/libc/string/swab.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/string/swab.c
diff -u src/lib/libc/string/swab.c:1.18 src/lib/libc/string/swab.c:1.19
--- src/lib/libc/string/swab.c:1.18	Tue Jan  4 17:14:07 2011
+++ src/lib/libc/string/swab.c	Wed Dec 28 14:32:04 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: swab.c,v 1.18 2011/01/04 17:14:07 martin Exp $	*/
+/*	$NetBSD: swab.c,v 1.19 2022/12/28 14:32:04 kre Exp $	*/
 
 /*
  * Copyright (c) 1988, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)swab.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: swab.c,v 1.18 2011/01/04 17:14:07 martin Exp $");
+__RCSID("$NetBSD: swab.c,v 1.19 2022/12/28 14:32:04 kre Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -68,8 +68,8 @@ swab(const void * __restrict from, void 
 	}
 
 	/* round to multiple of 8 */
-	while ((--len % 8) != 0)
-		STEP;
+	while ((len % 8) != 0)
+		len--, STEP;
 	len /= 8;
 	if (len == 0)
 		return;

Reply via email to