Skip to content

Commit 3b8ad1f

Browse files
committed
Use size of destination as third argument of strncpy()
Calling 'strncpy' with the size of the source buffer as the third argument may result in a buffer overflow.
1 parent 5e1947f commit 3b8ad1f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

gear-lib/libthread/libthread.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ int thread_set_name(struct thread *t, const char *name)
149149
printf("pthread_setname_np %s failed: %d\n", name, errno);
150150
return -1;
151151
}
152-
strncpy(t->name, name, strlen(name));
152+
strncpy(t->name, name, sizeof(t->name));
153153
return 0;
154154
#else
155155
return 0;

0 commit comments

Comments
 (0)