From 247cc8798942e0712d2620776e7ab3f72e3cd25c Mon Sep 17 00:00:00 2001 From: deraadt <> Date: Wed, 13 Feb 2019 22:57:08 +0000 Subject: [PATCH] (unsigned) means (unsigned int) which on ptrdiff_t or size_t or other larger types really is a range reduction... Almost any cast to (unsigned) is a bug. ok millert tb benno --- src/usr.sbin/ntpd/parse.y | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/usr.sbin/ntpd/parse.y b/src/usr.sbin/ntpd/parse.y index be1a7b53..6b436d55 100644 --- a/src/usr.sbin/ntpd/parse.y +++ b/src/usr.sbin/ntpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.70 2018/11/01 00:18:44 sashan Exp $ */ +/* $OpenBSD: parse.y,v 1.71 2019/02/13 22:57:08 deraadt Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer @@ -668,7 +668,7 @@ yylex(void) if (c == '-' || isdigit(c)) { do { *p++ = c; - if ((unsigned)(p-buf) >= sizeof(buf)) { + if ((size_t)(p-buf) >= sizeof(buf)) { yyerror("string too long"); return (findeol()); } @@ -707,7 +707,7 @@ nodigits: if (isalnum(c) || c == ':' || c == '_' || c == '*') { do { *p++ = c; - if ((unsigned)(p-buf) >= sizeof(buf)) { + if ((size_t)(p-buf) >= sizeof(buf)) { yyerror("string too long"); return (findeol()); }