Update of /cvsroot/alsa/alsa-kernel/core
In directory sc8-pr-cvs1:/tmp/cvs-serv31308/core

Modified Files:
        control.c hwdep.c init.c pcm.c pcm_native.c rawmidi.c timer.c 
Log Message:
Added strlcpy() strlcat() functions

Index: control.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/core/control.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- control.c   22 Apr 2003 14:16:47 -0000      1.33
+++ control.c   30 May 2003 12:28:32 -0000      1.34
@@ -222,7 +222,7 @@
        kctl.id.device = ncontrol->device;
        kctl.id.subdevice = ncontrol->subdevice;
        if (ncontrol->name)
-               strncpy(kctl.id.name, ncontrol->name, sizeof(kctl.id.name)-1);
+               strlcpy(kctl.id.name, ncontrol->name, sizeof(kctl.id.name));
        kctl.id.index = ncontrol->index;
        kctl.count = ncontrol->count ? ncontrol->count : 1;
        access = ncontrol->access == 0 ? SNDRV_CTL_ELEM_ACCESS_READWRITE :
@@ -445,12 +445,12 @@
        memset(&info, 0, sizeof(info));
        down_read(&snd_ioctl_rwsem);
        info.card = card->number;
-       strncpy(info.id, card->id, sizeof(info.id) - 1);
-       strncpy(info.driver, card->driver, sizeof(info.driver) - 1);
-       strncpy(info.name, card->shortname, sizeof(info.name) - 1);
-       strncpy(info.longname, card->longname, sizeof(info.longname) - 1);
-       strncpy(info.mixername, card->mixername, sizeof(info.mixername) - 1);
-       strncpy(info.components, card->components, sizeof(info.components) - 1);
+       strlcpy(info.id, card->id, sizeof(info.id));
+       strlcpy(info.driver, card->driver, sizeof(info.driver));
+       strlcpy(info.name, card->shortname, sizeof(info.name));
+       strlcpy(info.longname, card->longname, sizeof(info.longname));
+       strlcpy(info.mixername, card->mixername, sizeof(info.mixername));
+       strlcpy(info.components, card->components, sizeof(info.components));
        up_read(&snd_ioctl_rwsem);
        if (copy_to_user((void *) arg, &info, sizeof(snd_ctl_card_info_t)))
                return -EFAULT;

Index: hwdep.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/core/hwdep.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- hwdep.c     19 Feb 2003 15:37:04 -0000      1.16
+++ hwdep.c     30 May 2003 12:28:32 -0000      1.17
@@ -169,8 +169,8 @@
        
        memset(&info, 0, sizeof(info));
        info.card = hw->card->number;
-       strncpy(info.id, hw->id, sizeof(info.id) - 1);  
-       strncpy(info.name, hw->name, sizeof(info.name) - 1);
+       strlcpy(info.id, hw->id, sizeof(info.id));      
+       strlcpy(info.name, hw->name, sizeof(info.name));
        info.iface = hw->iface;
        if (copy_to_user(_info, &info, sizeof(info)))
                return -EFAULT;
@@ -343,7 +343,7 @@
        hwdep->card = card;
        hwdep->device = device;
        if (id) {
-               strncpy(hwdep->id, id, sizeof(hwdep->id) - 1);
+               strlcpy(hwdep->id, id, sizeof(hwdep->id));
        }
 #ifdef CONFIG_SND_OSSEMUL
        hwdep->oss_type = -1;

Index: init.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/core/init.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- init.c      19 Apr 2003 13:37:45 -0000      1.34
+++ init.c      30 May 2003 12:28:32 -0000      1.35
@@ -76,7 +76,7 @@
        if (xid) {
                if (!snd_info_check_reserved_words(xid))
                        goto __error;
-               strncpy(card->id, xid, sizeof(card->id) - 1);
+               strlcpy(card->id, xid, sizeof(card->id));
        }
        write_lock(&snd_card_rwlock);
        if (idx < 0) {

Index: pcm.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/core/pcm.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- pcm.c       30 Apr 2003 11:53:15 -0000      1.30
+++ pcm.c       30 May 2003 12:28:33 -0000      1.31
@@ -641,7 +641,7 @@
        pcm->card = card;
        pcm->device = device;
        if (id) {
-               strncpy(pcm->id, id, sizeof(pcm->id) - 1);
+               strlcpy(pcm->id, id, sizeof(pcm->id));
        }
        if ((err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_PLAYBACK, playback_count)) 
< 0) {
                snd_pcm_free(pcm);

Index: pcm_native.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/core/pcm_native.c,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -r1.73 -r1.74
--- pcm_native.c        21 May 2003 11:45:27 -0000      1.73
+++ pcm_native.c        30 May 2003 12:28:33 -0000      1.74
@@ -93,13 +93,13 @@
        info->device = pcm->device;
        info->stream = substream->stream;
        info->subdevice = substream->number;
-       strncpy(info->id, pcm->id, sizeof(info->id)-1);
-       strncpy(info->name, pcm->name, sizeof(info->name)-1);
+       strlcpy(info->id, pcm->id, sizeof(info->id));
+       strlcpy(info->name, pcm->name, sizeof(info->name));
        info->dev_class = pcm->dev_class;
        info->dev_subclass = pcm->dev_subclass;
        info->subdevices_count = pstr->substream_count;
        info->subdevices_avail = pstr->substream_count - pstr->substream_opened;
-       strncpy(info->subname, substream->name, sizeof(info->subname)-1);
+       strlcpy(info->subname, substream->name, sizeof(info->subname));
        runtime = substream->runtime;
        /* AB: FIXME!!! This is definitely nonsense */
        if (runtime) {

Index: rawmidi.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/core/rawmidi.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- rawmidi.c   10 Mar 2003 10:08:58 -0000      1.32
+++ rawmidi.c   30 May 2003 12:28:33 -0000      1.33
@@ -1394,7 +1394,7 @@
        init_MUTEX(&rmidi->open_mutex);
        init_waitqueue_head(&rmidi->open_wait);
        if (id != NULL)
-               strncpy(rmidi->id, id, sizeof(rmidi->id) - 1);
+               strlcpy(rmidi->id, id, sizeof(rmidi->id));
        if ((err = snd_rawmidi_alloc_substreams(rmidi, 
&rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT], SNDRV_RAWMIDI_STREAM_INPUT, input_count)) 
< 0) {
                snd_rawmidi_free(rmidi);
                return err;

Index: timer.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/core/timer.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- timer.c     11 Mar 2003 14:43:39 -0000      1.40
+++ timer.c     30 May 2003 12:28:33 -0000      1.41
@@ -749,7 +749,7 @@
        timer->tmr_device = tid->device;
        timer->tmr_subdevice = tid->subdevice;
        if (id)
-               strncpy(timer->id, id, sizeof(timer->id) - 1);
+               strlcpy(timer->id, id, sizeof(timer->id));
        INIT_LIST_HEAD(&timer->device_list);
        INIT_LIST_HEAD(&timer->open_list_head);
        INIT_LIST_HEAD(&timer->active_list_head);
@@ -1317,8 +1317,8 @@
                ginfo.card = t->card ? t->card->number : -1;
                if (t->hw.flags & SNDRV_TIMER_HW_SLAVE)
                        ginfo.flags |= SNDRV_TIMER_FLG_SLAVE;
-               strncpy(ginfo.id, t->id, sizeof(ginfo.id)-1);
-               strncpy(ginfo.name, t->name, sizeof(ginfo.name)-1);
+               strlcpy(ginfo.id, t->id, sizeof(ginfo.id));
+               strlcpy(ginfo.name, t->name, sizeof(ginfo.name));
                ginfo.resolution = t->hw.resolution;
                if (t->hw.resolution_min > 0) {
                        ginfo.resolution_min = t->hw.resolution_min;
@@ -1457,8 +1457,8 @@
        info.card = t->card ? t->card->number : -1;
        if (t->hw.flags & SNDRV_TIMER_HW_SLAVE)
                info.flags |= SNDRV_TIMER_FLG_SLAVE;
-       strncpy(info.id, t->id, sizeof(info.id)-1);
-       strncpy(info.name, t->name, sizeof(info.name)-1);
+       strlcpy(info.id, t->id, sizeof(info.id));
+       strlcpy(info.name, t->name, sizeof(info.name));
        info.resolution = t->hw.resolution;
        if (copy_to_user(_info, &info, sizeof(*_info)))
                return -EFAULT;



-------------------------------------------------------
This SF.net email is sponsored by: eBay
Get office equipment for less on eBay!
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to