Fix SVACE alert of possible buffer overflow in float2regex function 77/172077/2 sandbox/tcshin93/test submit/tizen/20180312.014711
authorSaulo Moraes <s.moraes@samsung.com>
Fri, 9 Mar 2018 11:35:17 +0000 (08:35 -0300)
committerSaulo Aldighieri Moraes <s.moraes@samsung.com>
Fri, 9 Mar 2018 13:22:33 +0000 (10:22 -0300)
Change-Id: I9e68e02dc2fa2aeb2ad27636f0198f4f4902c75d

server/src/service/DlpPrivacyInfoData.cpp

index 5bc8e92..79238f4 100644 (file)
@@ -50,7 +50,7 @@ DlpPrivacyInfoData::DlpPrivacyInfoData() : m_connection(NULL), m_locmgr(NULL), m
 
 static inline void float2regex(double pos, char *buffer, ssize_t len)
 {
-       int i;
+       unsigned int i;
 
     // pos value represents the latitude or longitude where
     // maximum possible value for pos should be +/-180
@@ -72,7 +72,7 @@ static inline void float2regex(double pos, char *buffer, ssize_t len)
 
        // At this point: -0.12\d{2}
        // Swift integer part: ignore signal and add '\' before '.'
-       for (i = 0; i < len - 1; i++) {
+       for (i = 0; i < strlen(buffer) - 1; i++) {
                if (buffer[i + 1] == '.') {
                        buffer[i] = '\\';
                        break;