Index | Thread | Search

From:
Theo Buehler <tb@theobuehler.org>
Subject:
Re: inet_aton -> inet_pton conversion: fix error checks
To:
tech <tech@openbsd.org>
Date:
Thu, 22 Aug 2024 10:08:27 +0200

Download raw body.

Thread
On Thu, Aug 22, 2024 at 08:58:53AM +0200, Florian Obser wrote:
> inet_pton returns 0 and -1 for error.
> Adjust the check that was now wrong after the inet_aton -> inet_pton
> conversion. Noticed by bluhm in ldpd.
> 
> I checked all the other conversions I did yesterday and there the error
> checking was correct.

I double checked this and confirm.

ok tb

Here's a tiny whitespace error introduced in one of them:

Index: parse.y
===================================================================
RCS file: /cvs/src/usr.sbin/ospfd/parse.y,v
diff -u -p -r1.105 parse.y
--- parse.y	21 Aug 2024 15:16:56 -0000	1.105
+++ parse.y	22 Aug 2024 08:06:02 -0000
@@ -620,7 +620,7 @@ areaid		: NUMBER {
 			$$.s_addr = htonl($1);
 		}
 		| STRING {
-		if (inet_pton(AF_INET, $1, &$$) != 1) {
+			if (inet_pton(AF_INET, $1, &$$) != 1) {
 				yyerror("error parsing area");
 				free($1);
 				YYERROR;