hrev43592 adds 1 changeset to branch 'master' old head: 12892428fc25be332fd490974628e3feda31a927 new head: e480c1b65813ef77f899e2e74a1324897f856e03 ---------------------------------------------------------------------------- e480c1b: echo driver: replace strncpy by strlcpy using strncpy could possibly lead to a non null terminated string. also some coding style fix. CID 2216. [ Philippe Saint-Pierre <stpere@xxxxxxxxx> ] ---------------------------------------------------------------------------- Revision: hrev43592 Commit: e480c1b65813ef77f899e2e74a1324897f856e03 URL: http://cgit.haiku-os.org/haiku/commit/?id=e480c1b Author: Philippe Saint-Pierre <stpere@xxxxxxxxx> Date: Mon Jan 2 00:42:16 2012 UTC ---------------------------------------------------------------------------- 1 files changed, 15 insertions(+), 9 deletions(-) src/add-ons/kernel/drivers/audio/echo/echo.cpp | 24 ++++++++++++------- ---------------------------------------------------------------------------- diff --git a/src/add-ons/kernel/drivers/audio/echo/echo.cpp b/src/add-ons/kernel/drivers/audio/echo/echo.cpp index c4e384e..85227f2 100644 --- a/src/add-ons/kernel/drivers/audio/echo/echo.cpp +++ b/src/add-ons/kernel/drivers/audio/echo/echo.cpp @@ -110,6 +110,7 @@ echo_mem_new(echo_dev *card, size_t size) return mem; } + void echo_mem_delete(echo_mem *mem) { @@ -118,6 +119,7 @@ echo_mem_delete(echo_mem *mem) free(mem); } + echo_mem * echo_mem_alloc(echo_dev *card, size_t size) { @@ -132,6 +134,7 @@ echo_mem_alloc(echo_dev *card, size_t size) return mem; } + void echo_mem_free(echo_dev *card, void *ptr) { @@ -248,7 +251,8 @@ echo_stream_set_audioparms(echo_stream *stream, uint8 channels, sample_size = stream->bitsPerSample / 8; frame_size = sample_size * stream->channels; - stream->buffer = echo_mem_alloc(stream->card, stream->bufframes * frame_size * stream->bufcount); + stream->buffer = echo_mem_alloc(stream->card, + stream->bufframes * frame_size * stream->bufcount); stream->trigblk = 1; stream->blkmod = stream->bufcount; @@ -322,6 +326,7 @@ echo_stream_start(echo_stream *stream, void (*inth) (void *), void *inthparam) } } + void echo_stream_halt(echo_stream *stream) { @@ -336,6 +341,7 @@ echo_stream_halt(echo_stream *stream) } } + echo_stream * echo_stream_new(echo_dev *card, uint8 use, uint32 bufframes, uint8 bufcount) { @@ -375,6 +381,7 @@ echo_stream_new(echo_dev *card, uint8 use, uint32 bufframes, uint8 bufcount) return stream; } + void echo_stream_delete(echo_stream *stream) { @@ -464,7 +471,7 @@ init_hardware(void) #ifdef CARDBUS return B_OK; #else - int ix=0; + int ix = 0; pci_info info; status_t err = ENODEV; @@ -545,7 +552,7 @@ init_driver(void) LIST_INIT(&(devices)); return B_OK; #else - int ix=0; + int ix = 0; pci_info info; status_t err; @@ -601,7 +608,7 @@ init_driver(void) } #endif if (echo_setup(&cards[num_cards])) { - PRINT(("Setup of "DRIVER_NAME" %ld failed\n", num_cards+1)); + PRINT(("Setup of "DRIVER_NAME" %ld failed\n", num_cards + 1)); #ifdef __HAIKU__ (*pci->unreserve_device)(info.bus, info.device, info.function, DRIVER_NAME, &cards[num_cards]); @@ -626,14 +633,13 @@ init_driver(void) #ifndef CARDBUS static void -make_device_names( - echo_dev * card) +make_device_names(echo_dev * card) { #ifdef MIDI_SUPPORT - sprintf(card->midi.name, "midi/"DRIVER_NAME"/%ld", card-cards+1); + sprintf(card->midi.name, "midi/"DRIVER_NAME"/%ld", card-cards + 1); names[num_names++] = card->midi.name; #endif - sprintf(card->name, "audio/hmulti/"DRIVER_NAME"/%ld", card-cards+1); + sprintf(card->name, "audio/hmulti/"DRIVER_NAME"/%ld", card-cards + 1); names[num_names++] = card->name; names[num_names] = NULL; @@ -851,7 +857,7 @@ echo_setup(echo_dev * card) #ifdef ECHO3G_FAMILY if (card->type == ECHO3G) { - strncpy(card->caps.szName, ((C3g*)card->pEG)->Get3gBoxName(), + strlcpy(card->caps.szName, ((C3g*)card->pEG)->Get3gBoxName(), ECHO_MAXNAMELEN); } #endif