From: Eric Sesterhenn <snakebyte@gmx.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: bdirks@pacbell.net
Subject: [Patch] Zoran strncpy() cleanup
Date: Mon, 05 Jun 2006 22:12:37 +0200 [thread overview]
Message-ID: <1149538357.16994.7.camel@alice> (raw)
hi,
this was spotted by coverity ( bug id #536 ). While
it is not really a bug, i think we should clean it up.
std->name can only hold 24 chars, not 32 as the strncpy() calls
suggest. std->name can hold 32 chars, but since we use constant
fixed-sized strings, which will always fit into these arrays, i changed
the strncpy() calls to strcpy(). If you prefer strncpy(foo->name, "bar", sizeof(foo->name))
please let me know and i redo the patch.
Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
--- linux-2.6.17-rc5/drivers/media/video/zoran_driver.c.orig 2006-06-05 22:06:42.000000000 +0200
+++ linux-2.6.17-rc5/drivers/media/video/zoran_driver.c 2006-06-05 22:08:50.000000000 +0200
@@ -3566,16 +3566,16 @@ zoran_do_ioctl (struct inode *inode,
switch (ctrl->id) {
case V4L2_CID_BRIGHTNESS:
- strncpy(ctrl->name, "Brightness", 31);
+ strcpy(ctrl->name, "Brightness");
break;
case V4L2_CID_CONTRAST:
- strncpy(ctrl->name, "Contrast", 31);
+ strcpy(ctrl->name, "Contrast");
break;
case V4L2_CID_SATURATION:
- strncpy(ctrl->name, "Saturation", 31);
+ strcpy(ctrl->name, "Saturation");
break;
case V4L2_CID_HUE:
- strncpy(ctrl->name, "Hue", 31);
+ strcpy(ctrl->name, "Hue");
break;
}
@@ -3693,7 +3693,7 @@ zoran_do_ioctl (struct inode *inode,
&caps);
if (caps.flags & VIDEO_DECODER_AUTO) {
std->id = V4L2_STD_ALL;
- strncpy(std->name, "Autodetect", 31);
+ strcpy(std->name, "Autodetect");
return 0;
} else
return -EINVAL;
@@ -3701,21 +3701,21 @@ zoran_do_ioctl (struct inode *inode,
switch (std->index) {
case 0:
std->id = V4L2_STD_PAL;
- strncpy(std->name, "PAL", 31);
+ strcpy(std->name, "PAL");
std->frameperiod.numerator = 1;
std->frameperiod.denominator = 25;
std->framelines = zr->card.tvn[0]->Ht;
break;
case 1:
std->id = V4L2_STD_NTSC;
- strncpy(std->name, "NTSC", 31);
+ strcpy(std->name, "NTSC");
std->frameperiod.numerator = 1001;
std->frameperiod.denominator = 30000;
std->framelines = zr->card.tvn[1]->Ht;
break;
case 2:
std->id = V4L2_STD_SECAM;
- strncpy(std->name, "SECAM", 31);
+ strcpy(std->name, "SECAM");
std->frameperiod.numerator = 1;
std->frameperiod.denominator = 25;
std->framelines = zr->card.tvn[2]->Ht;
@@ -3871,7 +3871,7 @@ zoran_do_ioctl (struct inode *inode,
memset(outp, 0, sizeof(*outp));
outp->index = 0;
outp->type = V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY;
- strncpy(outp->name, "Autodetect", 31);
+ strcpy(outp->name, "Autodetect");
return 0;
}
next reply other threads:[~2006-06-05 20:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-05 20:12 Eric Sesterhenn [this message]
2006-06-05 21:02 ` [Patch] Zoran strncpy() cleanup Horst Schirmeier
2006-06-05 21:15 ` Eric Sesterhenn
2006-06-05 21:36 ` Horst Schirmeier
2006-06-05 21:46 ` Eric Sesterhenn
2006-06-05 22:01 ` Horst Schirmeier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1149538357.16994.7.camel@alice \
--to=snakebyte@gmx.de \
--cc=bdirks@pacbell.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.