Fix coverity issue about fread 69/196769/1 accepted/tizen/4.0/unified/20190104.230803 submit/tizen_4.0/20190104.073831
authorSunghyun kim <scholb.kim@samsung.com>
Wed, 16 May 2018 06:19:31 +0000 (15:19 +0900)
committerSunghyun kim <scholb.kim@samsung.com>
Fri, 4 Jan 2019 06:31:56 +0000 (15:31 +0900)
- Fix Coverity Issue

Change-Id: Iae6c0c4ae599a3c999aee1333054a46e3f2c416e

widget_viewer_dali/internal/widget_view_manager/widget_view_manager_impl.cpp

index 58ff0cadc17cb2c59c8465dba22da409054768b7..fcc761765959f0ad20145cb0e89cf601e99f7fca 100644 (file)
@@ -99,7 +99,8 @@ static bool CheckPrivilege( const char* privilege )
   fp = fopen( labelPath , "r" );
   if(fp != NULL)
   {
-    if (fread( subjectLabel, 1, sizeof(subjectLabel), fp) <= 0)
+    ret = fread( subjectLabel, 1, sizeof(subjectLabel), fp);
+    if ( ret <= 0 )
     {
       fclose(fp);
       cynara_finish( cynara );
@@ -107,6 +108,7 @@ static bool CheckPrivilege( const char* privilege )
     }
     fclose(fp);
   }
+  subjectLabel[ret] = '\0';
 
   snprintf( uid, 10, "%d", getuid() );