Valgrind 抱怨 inet_pton()

问题描述 投票:0回答:1

Valgrind 在运行以下程序时会抱怨

inet_pton()

#include <stdio.h>
#include <arpa/inet.h>

int main()
{
  struct in6_addr addr;
  if (inet_pton(AF_INET6, "fe80::a00:27ff:fe80:e79", &addr) == 1) {
    printf("Valid IP address.\n");
  } else {
    printf("Invalid IP address.\n");
  }

  return 0;
}

输出:

Valid IP address.

Valgrind 给出以下错误:

==3903== Source and destination overlap in memcpy_chk(0x1ffefffe08, 0x1ffefffe02, 8)
==3903==    at 0x4851042: __memcpy_chk (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==3903==    by 0x49B29CC: memmove (string_fortified.h:36)
==3903==    by 0x49B29CC: inet_pton6 (inet_pton.c:226)
==3903==    by 0x49B29CC: __inet_pton_length (inet_pton.c:56)
==3903==    by 0x49B29CC: inet_pton (inet_pton.c:69)
==3903==    by 0x1091BE: main (in /home/user/inet_pton)

Valgrid版本:valgrind-3.21.0

Gcc版本:13.2.0-4ubuntu3

可能是什么原因?

c valgrind
1个回答
0
投票

Valgrind 中有一个错误:bugs.kde.org/show_bug.cgi?id=402833

© www.soinside.com 2019 - 2024. All rights reserved.