Fix for svace issue (233396, 233397, 233398) 76/149676/1 accepted/tizen/unified/20170914.065521 submit/tizen/20170914.011401
authorjh8801.jung <jh8801.jung@samsung.com>
Wed, 13 Sep 2017 01:57:18 +0000 (10:57 +0900)
committerjh8801.jung <jh8801.jung@samsung.com>
Wed, 13 Sep 2017 01:58:13 +0000 (10:58 +0900)
Signed-off-by: jh8801.jung <jh8801.jung@samsung.com>
Change-Id: Idad15b64963dc89db3ed25c2754d6a69c5ad8979

include/SEService.h
packaging/capi-network-smartcard.spec
src/Reader.cpp
src/SEService.cpp
src/Session.cpp

index 8a8aea9..563961e 100755 (executable)
@@ -91,11 +91,6 @@ public:
                        throw(ErrorIO &, ErrorIllegalParameter &, ExceptionBase &);
                ~SEService();
 
-               static SEService *createInstance(void *user_data, SEServiceListener *listener)
-                       throw(ErrorIO &, ErrorIllegalParameter &);
-               static SEService *createInstance(void *user_data, serviceConnected handler)
-                       throw(ErrorIO &, ErrorIllegalParameter &);
-
                void setEventHandler(se_service_event_cb cb, void *context);
                void shutdown();
                void shutdownSync();
index 677bc1b..e03cb07 100755 (executable)
@@ -1,7 +1,7 @@
 Name:       capi-network-smartcard
 Summary:    A Smartcard library in Native API
-Version:    0.0.11
-Release:    1
+Version:    0.0.12
+Release:    0
 Group:      Network & Connectivity/Smartcard
 License:    Apache-2.0
 Source0:    %{name}-%{version}.tar.gz
@@ -59,4 +59,4 @@ rm -rf %{buildroot}
 %{_includedir}/*.h
 %{_libdir}/pkgconfig/*.pc
 %{_libdir}/libcapi-network-smartcard.so
-%{_bindir}/smartcard_unit_test
\ No newline at end of file
+%{_bindir}/smartcard_unit_test
index 1c4f198..13f812a 100755 (executable)
@@ -110,7 +110,7 @@ namespace smartcard_service_api
                                &result, &session_id, NULL, &error) == true) {
                                if (result == SCARD_ERROR_OK) {
                                        /* create new instance of channel */
-                                       session = new Session(context, this,
+                                       session = new (std::nothrow)Session(context, this,
                                                GUINT_TO_POINTER(session_id));
                                        if (session != NULL) {
                                                sessions.push_back(session);
@@ -164,7 +164,7 @@ namespace smartcard_service_api
                        &result, &handle, res, &error) == true) {
                        if (result == SCARD_ERROR_OK) {
                                /* create new instance of channel */
-                               session = new Session(reader->context, reader,
+                               session = new (std::nothrow)Session(reader->context, reader,
                                        GUINT_TO_POINTER(handle));
                                if (session != NULL) {
                                        reader->sessions.push_back(session);
@@ -196,7 +196,7 @@ namespace smartcard_service_api
                _BEGIN();
 
                if (isSecureElementPresent() == true) {
-                       CallbackParam *param = new CallbackParam();
+                       CallbackParam *param = new (std::nothrow)CallbackParam();
 
                        param->instance = this;
                        param->callback = (void *)callback;
index 03d2d20..d0be217 100755 (executable)
@@ -98,20 +98,6 @@ namespace smartcard_service_api
                }
        }
 
-       SEService *SEService::createInstance(void *user_data,
-               SEServiceListener *listener)
-               throw(ErrorIO &, ErrorIllegalParameter &)
-       {
-               return new SEService(user_data, listener);
-       }
-
-       SEService *SEService::createInstance(void *user_data,
-               serviceConnected handler)
-               throw(ErrorIO &, ErrorIllegalParameter &)
-       {
-               return new SEService(user_data, handler);
-       }
-
        void SEService::reader_inserted(GObject *source_object,
                guint reader_id, gchar *reader_name, gpointer user_data)
        {
@@ -121,7 +107,7 @@ namespace smartcard_service_api
                _INFO("[MSG_NOTIFY_SE_INSERTED]");
 
                /* add readers */
-               reader = new Reader(service->context,
+               reader = new (std::nothrow)Reader(service->context,
                        reader_name, GUINT_TO_POINTER(reader_id));
 
                if (reader != NULL) {
@@ -473,7 +459,7 @@ namespace smartcard_service_api
                        SECURE_LOGD("Reader : name [%s], handle [%08x]", name, handle);
 
                        /* add readers */
-                       reader = new Reader(GUINT_TO_POINTER(this->handle), name, GUINT_TO_POINTER(handle));
+                       reader = new (std::nothrow)Reader(GUINT_TO_POINTER(this->handle), name, GUINT_TO_POINTER(handle));
                        if (reader == NULL)
                        {
                                _ERR("alloc failed");
@@ -528,7 +514,7 @@ namespace smartcard_service_api
                        SECURE_LOGD("Reader [%d] : name [%s], handle [%p]", i, name, handle);
 
                        /* add readers */
-                       reader = new Reader(context, name, handle);
+                       reader = new (std::nothrow)Reader(context, name, handle);
                        if (reader == NULL)
                        {
                                _ERR("alloc failed");
@@ -564,7 +550,7 @@ EXTERN_API se_service_h se_service_create_instance(void *user_data,
 
        try
        {
-               service = new SEService(user_data, (serviceConnected)callback);
+               service = new (std::nothrow)SEService(user_data, (serviceConnected)callback);
        }
        catch (...)
        {
@@ -582,7 +568,7 @@ EXTERN_API se_service_h se_service_create_instance_with_event_callback(
 
        try
        {
-               service = new SEService(user_data, (serviceConnected)connected);
+               service = new (std::nothrow)SEService(user_data, (serviceConnected)connected);
        }
        catch (...)
        {
@@ -599,7 +585,7 @@ EXTERN_API se_service_h se_service_create_instance_sync(void *user_data,
 
        try
        {
-               service = new SEService(user_data);
+               service = new (std::nothrow)SEService(user_data);
        }
        catch (ExceptionBase &e)
        {
index 00dfe3e..4270e4e 100755 (executable)
@@ -174,7 +174,7 @@ namespace smartcard_service_api
                                        var_response, response);
 
                                /* create new instance of channel */
-                               channel = new ClientChannel(session->context,
+                               channel = new (std::nothrow)ClientChannel(session->context,
                                        session, channel_id,
                                        response, GUINT_TO_POINTER(channel_id));
                                if (channel != NULL) {
@@ -292,7 +292,7 @@ namespace smartcard_service_api
 
                if (getReader()->isSecureElementPresent() == true) {
                        if (atr.isEmpty() == true) {
-                               CallbackParam *param = new CallbackParam();
+                               CallbackParam *param = new (std::nothrow)CallbackParam();
 
                                param->instance = this;
                                param->callback = (void *)callback;
@@ -362,7 +362,7 @@ namespace smartcard_service_api
                        closed = true;
                        closeChannels();
 
-                       CallbackParam *param = new CallbackParam();
+                       CallbackParam *param = new (std::nothrow)CallbackParam();
 
                        param->instance = this;
                        param->callback = (void *)callback;
@@ -426,7 +426,7 @@ namespace smartcard_service_api
                                                var_response, response);
 
                                        /* create new instance of channel */
-                                       channel = new ClientChannel(context,
+                                       channel = new (std::nothrow)ClientChannel(context,
                                                this, channel_number,
                                                response, GUINT_TO_POINTER(channel_id));
                                        if (channel != NULL) {
@@ -463,7 +463,7 @@ namespace smartcard_service_api
                if (getReader()->isSecureElementPresent() == true) {
                        GVariant *var_aid;
 
-                       CallbackParam *param = new CallbackParam();
+                       CallbackParam *param = new (std::nothrow)CallbackParam();
 
                        param->instance = this;
                        param->callback = (void *)callback;