Merge "Fix destination buffer too small issue by static analyze tool code with strcpy is not proposed, replace with strncpy"
This commit is contained in:
commit
ac6339b3c3
@ -324,8 +324,10 @@ int virtio_channel_connect ( instInfo * instInfo_ptr )
|
|||||||
struct sockaddr_un un;
|
struct sockaddr_un un;
|
||||||
un.sun_family = AF_UNIX;
|
un.sun_family = AF_UNIX;
|
||||||
|
|
||||||
strcpy(un.sun_path, buf);
|
strncpy(un.sun_path, buf, sizeof(un.sun_path)-1);
|
||||||
len = offsetof(struct sockaddr_un, sun_path) + strlen(buf);
|
un.sun_path[sizeof(un.sun_path)-1] = '\0';
|
||||||
|
|
||||||
|
len = offsetof(struct sockaddr_un, sun_path) + strlen(un.sun_path);
|
||||||
rc = connect(instInfo_ptr->chan_fd, (struct sockaddr *)&un, len);
|
rc = connect(instInfo_ptr->chan_fd, (struct sockaddr *)&un, len);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user