Heap corruption fixed 34/191934/1
authorSudipto <sudipto.bal@samsung.com>
Thu, 25 Oct 2018 16:46:53 +0000 (22:16 +0530)
committerSudipto <sudipto.bal@samsung.com>
Thu, 25 Oct 2018 16:46:53 +0000 (22:16 +0530)
Change-Id: I4b0f613ddc9bd7d516f8193733d4d089df2bbb79
Signed-off-by: Sudipto <sudipto.bal@samsung.com>
src/client/sensor_listener.cpp
src/server/server_channel_handler.cpp
src/shared/command_types.h

index f20c3d1..96a7076 100644 (file)
@@ -399,7 +399,7 @@ int sensor_listener::set_attribute(int attribute, const char *value, int len)
        buf->listener_id = m_id;
        buf->attribute = attribute;
 
-       memcpy(buf->value, value, len);
+       memcpy(&buf->value, value, len);
        buf->len = len;
 
        msg.enclose((char *)buf, size);
index 149c32e..a62b75b 100644 (file)
@@ -265,7 +265,7 @@ int server_channel_handler::listener_attr_str(channel *ch, message &msg)
                return -EACCES;
        }
 
-       int ret = m_listeners[id]->set_attribute(buf->attribute, buf->value, buf->len);
+       int ret = m_listeners[id]->set_attribute(buf->attribute, (char *)&buf->value, buf->len);
        if (ret < 0) {
                delete [] buf;
                return ret;
index d28107d..34cb5fc 100644 (file)
@@ -88,7 +88,7 @@ typedef struct  {
        int listener_id;
        int attribute;
        int len;
-       char *value;
+       char value[0];
 } cmd_listener_attr_str_t;
 
 typedef struct {