AOSP 中间件中的致命信号 11 (SIGSEGV)

Fatal signal 11 (SIGSEGV) in AOSP middleware

我正在尝试像下面这样连接字符串

typedef struct IInfo
  {
    char cmAddress[6];                      
    UINT8 IpAddress[4];                     
    UINT8 hIpAddress[4];                    
  } IInfo;

在我的文件中:

     IInfo Info;
    char CableIP[50];

   __android_log_print(ANDROID_LOG_DEBUG,"test","test--> %s:%d IpAddress[0] : %d,IpAddress[1] : %d,IpAddress[2] : %d,IpAddress[3] : %d\n", __FUNCTION__, __LINE__, Info.IpAddress[0], Info.IpAddress[1],Info.IpAddress[2], Info.IpAddress[3]);


    strcpy(CableIP,Info.IpAddress[0]);//10
    strcat(CableIP,"." );
    strcat(CableIP,Info.IpAddress[1] );//1
    strcat(CableIP,"." );
    strcat(CableIP,Info.IpAddress[2] );//120
    strcat(CableIP,"." );
    strcat(CableIP,Info.IpAddress[3] );//36
    printf("CableIP %s",CableIP);

打印如下: 测试:测试--> _ExecuteFUN:298 IpAddress[0] : 10,IpAddress[1] : 1,IpAddress[2] : 120,IpAddress[3] : 36

预期输出为 10.1.120.36

但低于错误 F libc:致命信号 11 (SIGSEGV),代码 1,tid 2888 中的故障地址 0xa (n0000001)

一个单独的数组元素打印得到正确的数据,但是如果我做连接得到一个错误。

请问我哪里做错了,请指点一下好吗?

   char *strcpy(char *restrict dest, const char *src);

The strcpy() function copies the string pointed to by src, including the terminating null byte ('[=14=]'), to the buffer pointed to by dest. - For more

Info.IpAddressUINT8 类型的数组,而不是 char*.

我希望如下

sprintf(CableIP, "%u.%u.%u.%u%c", Info.IpAddress[0], Info.IpAddress[1], Info.IpAddress[2], Info.IpAddress[3], '[=11=]');