Skip to content

Commit 83d0605

Browse files
committed
Version 2.1.3
Use strscpy instead of strlcpy. Linux 6.8 has removed strlcpy. Closes #271
1 parent add5733 commit 83d0605

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

src/common.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
#ifndef _COMMON_H_
1010
#define _COMMON_H_
1111

12-
#define APP_VER_INT 212
13-
#define APP_VER_STR "2.1.2"
12+
#define APP_VER_INT 213
13+
#define APP_VER_STR "2.1.3"
1414

1515
#define MSG_ERROR(str) ShowError("Error",str)
1616
#define MSG_LASTERROR(str) ShowError(str,strerror(errno))

v4l2loopback/v4l2loopback-dc.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ void * v4l2l_vzalloc (unsigned long size) {
7373
#include <linux/sched.h>
7474
#include <linux/slab.h>
7575

76+
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0)
77+
#define strscpy strlcpy
78+
#endif
79+
7680
#if defined(timer_setup) && defined(from_timer)
7781
#define HAVE_TIMER_SETUP
7882
#endif
@@ -619,8 +623,8 @@ vidioc_querycap (struct file *file,
619623
struct v4l2_loopback_device *dev = v4l2loopback_getdevice(file);
620624
int devnr = ((struct v4l2loopback_private *)video_get_drvdata(dev->vdev))->devicenr;
621625

622-
strlcpy(cap->driver, "Droidcam", sizeof(cap->driver));
623-
strlcpy(cap->card , "Droidcam", sizeof(cap->card));
626+
strscpy(cap->driver, "Droidcam", sizeof(cap->driver));
627+
strscpy(cap->card , "Droidcam", sizeof(cap->card));
624628
snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:v4l2loopback_dc-%03d", devnr);
625629

626630
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 1, 0)
@@ -740,7 +744,7 @@ vidioc_enum_fmt_cap (struct file *file,
740744
return -EINVAL;
741745
if (dev->ready_for_capture) {
742746
const __u32 format = dev->pix_format.pixelformat;
743-
// strlcpy(f->description, "current format", sizeof(f->description));
747+
// strscpy(f->description, "current format", sizeof(f->description));
744748

745749
snprintf(f->description, sizeof(f->description),
746750
"[%c%c%c%c]",
@@ -868,7 +872,7 @@ vidioc_enum_fmt_out (struct file *file,
868872
f->pixelformat=fmt->fourcc;
869873
format = f->pixelformat;
870874

871-
// strlcpy(f->description, "dummy OUT format", sizeof(f->description));
875+
// strscpy(f->description, "dummy OUT format", sizeof(f->description));
872876
snprintf(f->description, sizeof(f->description),
873877
fmt->name);
874878

@@ -1281,7 +1285,7 @@ vidioc_enum_output (struct file *file,
12811285
memset(outp, 0, sizeof(*outp));
12821286

12831287
outp->index = index;
1284-
strlcpy(outp->name, "loopback in", sizeof(outp->name));
1288+
strscpy(outp->name, "loopback in", sizeof(outp->name));
12851289
outp->type = V4L2_OUTPUT_TYPE_ANALOG;
12861290
outp->audioset = 0;
12871291
outp->modulator = 0;
@@ -1350,7 +1354,7 @@ vidioc_enum_input (struct file *file,
13501354
memset(inp, 0, sizeof(*inp));
13511355

13521356
inp->index = index;
1353-
strlcpy(inp->name, "loopback", sizeof(inp->name));
1357+
strscpy(inp->name, "loopback", sizeof(inp->name));
13541358
inp->type = V4L2_INPUT_TYPE_CAMERA;
13551359
inp->audioset = 0;
13561360
inp->tuner = 0;
@@ -2130,7 +2134,7 @@ static void
21302134
init_vdev (struct video_device *vdev)
21312135
{
21322136
MARK();
2133-
strlcpy(vdev->name, "Loopback video device", sizeof(vdev->name));
2137+
strscpy(vdev->name, "Loopback video device", sizeof(vdev->name));
21342138

21352139
#if 0
21362140
//todo: remove V4L2_STD stuff

0 commit comments

Comments
 (0)