summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeungbae Shin <seungbae.shin@samsung.com>2017-10-10 16:07:36 +0900
committerSeungbae Shin <seungbae.shin@samsung.com>2017-10-11 18:51:01 +0900
commitc276d981d636c4c5ff3633375dc396e215069a14 (patch)
tree20732d46fea556e08e72a6b93e6c95bc85dc5151
parent48ae2414092cfc928a5d48cd1e5d2956e1cd8eeb (diff)
downloadlibmm-session-c276d981d636c4c5ff3633375dc396e215069a14.tar.gz
libmm-session-c276d981d636c4c5ff3633375dc396e215069a14.tar.bz2
libmm-session-c276d981d636c4c5ff3633375dc396e215069a14.zip
[Version] 0.2.15 [Issue Type] Security Change-Id: I8339fc77cf2978f9a800a61423da0865d8e2f64a
-rw-r--r--mm_session.c29
-rw-r--r--packaging/libmm-session.spec2
2 files changed, 21 insertions, 10 deletions
diff --git a/mm_session.c b/mm_session.c
index b7e8a49..1358df0 100644
--- a/mm_session.c
+++ b/mm_session.c
@@ -266,6 +266,7 @@ int _mm_session_util_read_type(int app_pid, int *sessiontype)
pid_t mypid;
int fd = -1;
char filename[MAX_FILE_LENGTH];
+ int result = MM_ERROR_NONE;
debug_fenter();
@@ -283,15 +284,20 @@ int _mm_session_util_read_type(int app_pid, int *sessiontype)
if (fd < 0)
return MM_ERROR_INVALID_HANDLE;
- read(fd, sessiontype, sizeof(int));
- *sessiontype = *sessiontype >> 16;
- debug_warning("read sessiontype(%d) from /tmp/mm_session_%d", *sessiontype, mypid);
+ if (read(fd, sessiontype, sizeof(int)) == sizeof(int)) {
+ *sessiontype = *sessiontype >> 16;
+ debug_warning("read sessiontype(%d) from /tmp/mm_session_%d", *sessiontype, mypid);
+ } else {
+ debug_error("failed to read from %s, errno %d", filename, errno);
+ result = MM_ERROR_INVALID_HANDLE;
+ }
+
close(fd);
////// READ SESSION TYPE /////////
debug_fleave();
- return MM_ERROR_NONE;
+ return result;
}
EXPORT_API
@@ -341,6 +347,7 @@ int _mm_session_util_read_information(int app_pid, int *session_type, int *flags
int fd = -1;
char filename[MAX_FILE_LENGTH];
int result_info = 0;
+ int result = MM_ERROR_NONE;
debug_fenter();
@@ -357,17 +364,21 @@ int _mm_session_util_read_information(int app_pid, int *session_type, int *flags
fd = open(filename, O_RDONLY);
if (fd < 0)
return MM_ERROR_INVALID_HANDLE;
- read(fd, &result_info, sizeof(int));
- *session_type = result_info >> 16;
- *flags = result_info & 0x0000ffff;
+ if (read(fd, &result_info, sizeof(int)) == sizeof(int)) {
+ *session_type = result_info >> 16;
+ *flags = result_info & 0x0000ffff;
+ debug_warning("read session_type(%d), session_option(%x) from /tmp/mm_session_%d", *session_type, *flags, mypid);
+ } else {
+ debug_error("failed to read from %s, errno %d", filename, errno);
+ result = MM_ERROR_INVALID_HANDLE;
+ }
- debug_warning("read session_type(%d), session_option(%x) from /tmp/mm_session_%d", *session_type, *flags, mypid);
close(fd);
////// READ SESSION INFO /////////
debug_fleave();
- return MM_ERROR_NONE;
+ return result;
}
void __session_signal_handler(int signo, siginfo_t *siginfo, void *context)
diff --git a/packaging/libmm-session.spec b/packaging/libmm-session.spec
index aa9113a..d862329 100644
--- a/packaging/libmm-session.spec
+++ b/packaging/libmm-session.spec
@@ -1,6 +1,6 @@
Name: libmm-session
Summary: Multimedia Session Library
-Version: 0.2.14
+Version: 0.2.15
Release: 0
Group: Multimedia/Libraries
License: Apache-2.0