git: 250bb6793a2b - main - bsnmp: fix undefined behaviour
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 01 Aug 2025 14:15:05 UTC
The branch main has been updated by ivy:
URL: https://cgit.FreeBSD.org/src/commit/?id=250bb6793a2bc4d2530eb304ac4c4f03ea585985
commit 250bb6793a2bc4d2530eb304ac4c4f03ea585985
Author: Lexi Winter <ivy@FreeBSD.org>
AuthorDate: 2025-07-31 11:18:40 +0000
Commit: Lexi Winter <ivy@FreeBSD.org>
CommitDate: 2025-08-01 14:06:39 +0000
bsnmp: fix undefined behaviour
Modifying and using a variable without an intervening sequence point
is undefined behaviour, which causes an error in the GCC build.
Reviewed by: harti, emaste
Differential Revision: https://reviews.freebsd.org/D51576
---
contrib/bsnmp/lib/snmpclient.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/contrib/bsnmp/lib/snmpclient.c b/contrib/bsnmp/lib/snmpclient.c
index 44dfbd5a06b1..01e46480abb8 100644
--- a/contrib/bsnmp/lib/snmpclient.c
+++ b/contrib/bsnmp/lib/snmpclient.c
@@ -2096,7 +2096,9 @@ get_port(struct snmp_client *sc, const char *port[2])
return (NULL);
}
- return (port[1] = ++(port[0]) + strlen(port[0]));
+ ++port[0];
+ port[1] = port[0] + strlen(port[0]);
+ return (port[1]);
}
/**