summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packaging/capi-media-recorder.spec2
-rw-r--r--src/recorder.c14
2 files changed, 12 insertions, 4 deletions
diff --git a/packaging/capi-media-recorder.spec b/packaging/capi-media-recorder.spec
index e5a3eef..4936912 100644
--- a/packaging/capi-media-recorder.spec
+++ b/packaging/capi-media-recorder.spec
@@ -1,6 +1,6 @@
Name: capi-media-recorder
Summary: A Recorder API
-Version: 0.2.53
+Version: 0.2.54
Release: 0
Group: Multimedia/API
License: Apache-2.0
diff --git a/src/recorder.c b/src/recorder.c
index 4e09c86..5b0d745 100644
--- a/src/recorder.c
+++ b/src/recorder.c
@@ -2024,9 +2024,10 @@ int recorder_get_audio_level(recorder_h recorder, double *level)
}
-int recorder_set_filename(recorder_h recorder, const char *filename)
+int recorder_set_filename(recorder_h recorder, const char *filename)
{
int ret = RECORDER_ERROR_NONE;
+ size_t length = 0;
muse_recorder_api_e api = MUSE_RECORDER_API_SET_FILENAME;
recorder_cli_s *pc = (recorder_cli_s *)recorder;
recorder_msg_param param;
@@ -2042,11 +2043,18 @@ int recorder_set_filename(recorder_h recorder, const char *filename)
return RECORDER_ERROR_INVALID_PARAMETER;
}
- LOGD("ENTER");
+ LOGD("ENTER [%s]", filename);
+
+ length = strlen(filename);
+
+ if (length >= RECORDER_FILENAME_MAX - 1) {
+ LOGE("too long file name [%d]", length);
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
if (storage_get_origin_internal_path(filename, RECORDER_FILENAME_MAX, set_filename) < 0) {
/* Cannot convert. Use original path. */
- strncpy(set_filename, filename, strlen(filename));
+ strncpy(set_filename, filename, length + 1);
} else {
/* Converted. Use converted path. */
LOGD("Converted filename : %s -> %s", filename, set_filename);