[FIX] Add string saving exception handling (in PackArguments)
authorDmitry Kovalenko <d.kovalenko@samsung.com>
Tue, 14 May 2013 15:55:02 +0000 (19:55 +0400)
committerDmitry Kovalenko <d.kovalenko@samsung.com>
Tue, 14 May 2013 15:55:02 +0000 (19:55 +0400)
driver/events.h

index b644ab7..0fc63d1 100644 (file)
@@ -159,8 +159,12 @@ static char *PackArguments (char *pBuffer, unsigned long nLen, const char *szFor
                                if(strncpy_from_user(pResult,
                                                     user_s,
                                                     nLengthOfString) != (nLengthOfString-1)) {
+                                       const char err_str[] =
+                                               "(failed strcpy_from_user)";
                                        EPRINTF("failed to copy string from user %p, bytes %d",
                                                user_s, nLengthOfString);
+                                       nLengthOfString = sizeof(err_str);
+                                       memcpy(pResult, err_str, nLengthOfString);
                                }
                        }
                        else