Merge "Fix string copy termination" into pi-dev

gugelfrei
Andy Hung 6 years ago committed by Android (Google) Code Review
commit 6b6f4313aa

@ -24,6 +24,7 @@
#include <pthread.h>
#include <stdio.h>
#include <string.h>
#include <audio_utils/string.h>
#define MIN(a, b) ((a) < (b) ? (a) : (b))
@ -117,7 +118,7 @@ BufLogStream::BufLogStream(unsigned int id,
mByteCount = 0l;
mPaused = false;
if (tag != NULL) {
strncpy(mTag, tag, BUFLOGSTREAM_MAX_TAGSIZE);
(void)audio_utils_strlcpy(mTag, tag);
} else {
mTag[0] = 0;
}

@ -36,6 +36,7 @@ LOCAL_C_INCLUDES := \
frameworks/av/services/audiopolicy/common/include \
frameworks/av/services/audiopolicy \
frameworks/av/services/audiopolicy/utilities \
system/media/audio_utils/include \
ifeq ($(USE_XML_AUDIO_POLICY_CONF), 1)

@ -17,6 +17,7 @@
#define LOG_TAG "APM::Devices"
//#define LOG_NDEBUG 0
#include <audio_utils/string.h>
#include "DeviceDescriptor.h"
#include "TypeConverter.h"
#include "AudioGain.h"
@ -247,7 +248,7 @@ void DeviceDescriptor::toAudioPortConfig(struct audio_port_config *dstConfig,
// ALOG_ASSERT(mModule != NULL);
dstConfig->ext.device.hw_module =
mModule != 0 ? mModule->getHandle() : AUDIO_MODULE_HANDLE_NONE;
strncpy(dstConfig->ext.device.address, mAddress.string(), AUDIO_DEVICE_MAX_ADDRESS_LEN);
(void)audio_utils_strlcpy_zerofill(dstConfig->ext.device.address, mAddress.string());
}
void DeviceDescriptor::toAudioPort(struct audio_port *port) const
@ -258,7 +259,7 @@ void DeviceDescriptor::toAudioPort(struct audio_port *port) const
toAudioPortConfig(&port->active_config);
port->ext.device.type = mDeviceType;
port->ext.device.hw_module = mModule->getHandle();
strncpy(port->ext.device.address, mAddress.string(), AUDIO_DEVICE_MAX_ADDRESS_LEN);
(void)audio_utils_strlcpy_zerofill(port->ext.device.address, mAddress.string());
}
void DeviceDescriptor::importAudioPort(const sp<AudioPort>& port, bool force) {

Loading…
Cancel
Save