From b3fe883d9c00487330dfe29d160016b4b87f3628 Mon Sep 17 00:00:00 2001 From: Philippe Saint-Pierre Date: Sun, 27 Nov 2011 12:05:41 -0500 Subject: [PATCH] replace usage of strncpy by strlcpy to insure NULL termination CID 10631 --- .../kernel/drivers/audio/ac97/sis7018/Mixer.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/add-ons/kernel/drivers/audio/ac97/sis7018/Mixer.cpp b/src/add-ons/kernel/drivers/audio/ac97/sis7018/Mixer.cpp index e3de2300f9..767b9e6041 100644 --- a/src/add-ons/kernel/drivers/audio/ac97/sis7018/Mixer.cpp +++ b/src/add-ons/kernel/drivers/audio/ac97/sis7018/Mixer.cpp @@ -477,7 +477,7 @@ Mixer::_CreateMIXControlGroup(multi_mix_control_info* MultiInfo, int32& index, Controls[index].parent = parentIndex; Controls[index].string = Info.fNameId; if (Info.fName != NULL) - strncpy(Controls[index].name, Info.fName, sizeof(Controls[index].name)); + strlcpy(Controls[index].name, Info.fName, sizeof(Controls[index].name)); index++; if (Info.fType & MIX_Mute) { @@ -499,7 +499,7 @@ Mixer::_CreateMIXControlGroup(multi_mix_control_info* MultiInfo, int32& index, Controls[index].parent = groupIndex; Controls[index].string = Info.fExNameId; if (Info.fExName != NULL) - strncpy(Controls[index].name, Info.fExName, + strlcpy(Controls[index].name, Info.fExName, sizeof(Controls[index].name)); TRACE("Enable:%#010x\n", Controls[index].id); @@ -534,7 +534,7 @@ Mixer::_CreateMIXControlGroup(multi_mix_control_info* MultiInfo, int32& index, Controls[index].parent = groupIndex; Controls[index].string = Info.fExNameId; if (Info.fExName != NULL) - strncpy(Controls[index].name, Info.fExName, + strlcpy(Controls[index].name, Info.fExName, sizeof(Controls[index].name)); TRACE("Boost:%#010x\n", Controls[index].id); @@ -548,7 +548,7 @@ Mixer::_CreateMIXControlGroup(multi_mix_control_info* MultiInfo, int32& index, Controls[index].flags = B_MULTI_MIX_MUX; Controls[index].parent = groupIndex; Controls[index].string = S_null; - strncpy(Controls[index].name, Info.fExName, sizeof(Controls[index].name)); + strlcpy(Controls[index].name, Info.fExName, sizeof(Controls[index].name)); TRACE("MUX:%#010x\n", Controls[index].id); index++; @@ -602,7 +602,7 @@ Mixer::ListMixControls(multi_mix_control_info* Info) Controls[index].flags = B_MULTI_MIX_GROUP; Controls[index].parent = 0; Controls[index].string = S_null; - strncpy(Controls[index].name, "Record", sizeof(Controls[index].name)); + strlcpy(Controls[index].name, "Record", sizeof(Controls[index].name)); index++; for (size_t i = 0; i < _countof(RecordControls); i++) {