summaryrefslogtreecommitdiff
path: root/v4l2-apps/util/v4l2-dbg.cpp
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2008-08-04 19:42:57 +0200
committerHans Verkuil <hverkuil@xs4all.nl>2008-08-04 19:42:57 +0200
commit053556a4eefa963d9b4c6dd40cbf8a51579753f1 (patch)
tree846bd62ecc2df7a2b906cf5bc1724a793ab949ba /v4l2-apps/util/v4l2-dbg.cpp
parentac532d001dbd78c75ab437d4b1d975f11221c2b7 (diff)
downloadmediapointer-dvb-s2-053556a4eefa963d9b4c6dd40cbf8a51579753f1.tar.gz
mediapointer-dvb-s2-053556a4eefa963d9b4c6dd40cbf8a51579753f1.tar.bz2
v4l2-dbg/v4l2-ctl: fix buffer overrun.
From: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Diffstat (limited to 'v4l2-apps/util/v4l2-dbg.cpp')
-rw-r--r--v4l2-apps/util/v4l2-dbg.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/v4l2-apps/util/v4l2-dbg.cpp b/v4l2-apps/util/v4l2-dbg.cpp
index 0ffd9de64..2561f42b2 100644
--- a/v4l2-apps/util/v4l2-dbg.cpp
+++ b/v4l2-apps/util/v4l2-dbg.cpp
@@ -272,7 +272,7 @@ int main(int argc, char **argv)
/* command args */
int ch;
- char *device = strdup("/dev/video0"); /* -d device */
+ const char *device = "/dev/video0"; /* -d device */
struct v4l2_capability vcap; /* list_cap */
struct v4l2_register set_reg;
struct v4l2_register get_reg;
@@ -311,11 +311,13 @@ int main(int argc, char **argv)
usage();
return 0;
case OptSetDevice:
- device = strdup(optarg);
+ device = optarg;
if (device[0] >= '0' && device[0] <= '9' && device[1] == 0) {
+ static char newdev[20];
char dev = device[0];
- sprintf(device, "/dev/video%c", dev);
+ sprintf(newdev, "/dev/video%c", dev);
+ device = newdev;
}
break;
case OptSetRegister:
@@ -424,7 +426,6 @@ int main(int argc, char **argv)
strerror(errno));
exit(1);
}
- free(device);
doioctl(fd, VIDIOC_QUERYCAP, &vcap, "VIDIOC_QUERYCAP");
capabilities = vcap.capabilities;