[media] radio: NUL terminate a user string
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 23 Nov 2011 05:45:40 +0000 (02:45 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 25 Nov 2011 17:46:59 +0000 (15:46 -0200)
We pass this to fm_tx_set_radio_text() which expects a NUL terminated
string.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/radio/wl128x/fmdrv_v4l2.c

index 4f5c43d2566c887444a91329b64a3960229e5278..077d369a017318e40849466c92bea074c94b46c1 100644 (file)
@@ -84,6 +84,7 @@ static ssize_t fm_v4l2_fops_write(struct file *file, const char __user * buf,
        struct fmdev *fmdev;
 
        ret = copy_from_user(&rds, buf, sizeof(rds));
+       rds.text[sizeof(rds.text) - 1] = '\0';
        fmdbg("(%d)type: %d, text %s, af %d\n",
                   ret, rds.text_type, rds.text, rds.af_freq);
        if (ret)