From: millert Date: Thu, 13 Jul 2023 20:33:30 +0000 (+0000) Subject: bcmp(3) tries to return length, which is a size_t, as an int. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=996ed212dfaa3a04ce46abccc4c9546db1b8a756;p=openbsd bcmp(3) tries to return length, which is a size_t, as an int. Instead, just return 1 if there is a difference, else 0. Fixed by ray@ in 2008 but the libkern version was not synced. OK deraadt@ --- diff --git a/sys/lib/libkern/bcmp.c b/sys/lib/libkern/bcmp.c index 6e7585eb05a..8d82e584fa4 100644 --- a/sys/lib/libkern/bcmp.c +++ b/sys/lib/libkern/bcmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bcmp.c,v 1.13 2021/05/16 04:51:00 jsg Exp $ */ +/* $OpenBSD: bcmp.c,v 1.14 2023/07/13 20:33:30 millert Exp $ */ /* * Copyright (c) 1987 Regents of the University of California. @@ -42,12 +42,12 @@ bcmp(const void *b1, const void *b2, size_t length) char *p1, *p2; if (length == 0) - return(0); + return (0); p1 = (char *)b1; p2 = (char *)b2; do if (*p1++ != *p2++) - break; + return (1); while (--length); - return(length); + return (0); }