aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDonny Xia <xiadong.main@gmail.com>2024-02-26 17:24:38 -0800
committerBen Hutchings <ben@decadent.org.uk>2024-03-21 21:36:36 +0100
commit37e2380785d2b1f16a5955b0e01e246cbdb53fad (patch)
tree149dfb99209b9e6a3d59857ad97579e1a960a25c
parent47b2771e2d0762e9b1b9af00a42792c17f35774e (diff)
[klibc] Fix the inet_pton implementation
The function inet_pton should read from src but it actually reads from dst. Signed-off-by: Donny Xia <xiadong.main@gmail.com> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r--usr/klibc/inet/inet_pton.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr/klibc/inet/inet_pton.c b/usr/klibc/inet/inet_pton.c
index 19fe16e03f98d..2df6b677653f4 100644
--- a/usr/klibc/inet/inet_pton.c
+++ b/usr/klibc/inet/inet_pton.c
@@ -38,7 +38,7 @@ int inet_pton(int af, const char *src, void *dst)
/* A double colon will increment colons by 2,
dcolons by 1 */
- for (p = dst; *p; p++) {
+ for (p = src; *p; p++) {
if (p[0] == ':') {
colons++;
if (p[1] == ':')
@@ -54,7 +54,7 @@ int inet_pton(int af, const char *src, void *dst)
memset(d, 0, sizeof(struct in6_addr));
i = 0;
- for (p = dst; *p; p++) {
+ for (p = src; *p; p++) {
if (*p == ':') {
if (p[1] == ':') {
i += (8 - colons);