Skip to content

Commit 0f6a823

Browse files
committed
fdsend-common: using strncpy instead of strcpy
1 parent 1b107a5 commit 0f6a823

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

misc-utils/fdsend-common.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ static int sockpath_from_spec(const char *spec, char *path, size_t size)
6666
errno = ENAMETOOLONG;
6767
return -1;
6868
}
69-
strcpy(path, spec);
69+
strncpy(path, spec, size);
7070
return 0;
7171
}
7272

@@ -123,7 +123,7 @@ static int fdsend_wait_for_socket(const char *sockpath, int blocking)
123123
errno = ENAMETOOLONG;
124124
return -1;
125125
}
126-
strcpy(dir, sockpath);
126+
strncpy(dir, sockpath, sizeof(dir));
127127
base = strrchr(dir, '/');
128128
if (base) {
129129
*base = '\0';

0 commit comments

Comments
 (0)