1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

cov: replace strcat with safe snprintf

This commit is contained in:
Zdenek Kabelac 2024-05-04 22:00:51 +02:00
parent 4761753a6f
commit db40a2e33c

View File

@ -159,10 +159,9 @@ static int _do_flock(const char *file, int *fd, int operation, uint32_t nonblock
static int _do_write_priority_flock(const char *file, int *fd, int operation, uint32_t nonblock)
{
int r, fd_aux = -1;
char *file_aux = alloca(strlen(file) + sizeof(AUX_LOCK_SUFFIX));
char file_aux[PATH_MAX];
strcpy(file_aux, file);
strcat(file_aux, AUX_LOCK_SUFFIX);
snprintf(file_aux, sizeof(file_aux), "%s%s", file, AUX_LOCK_SUFFIX);
if ((r = _do_flock(file_aux, &fd_aux, LOCK_EX, nonblock))) {
if (operation == LOCK_EX) {