Prevent integer underflow issue 67/188267/3
authorInHong Han <inhong1.han@samsung.com>
Mon, 3 Sep 2018 10:41:48 +0000 (19:41 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Tue, 4 Sep 2018 10:13:56 +0000 (10:13 +0000)
An integer underflow may occur due to arithmetic operation (unsigned subtraction)
between variable 'lendir' and value '1', when 'lendir' is equal to '0'

Change-Id: I569ff1e74e5e923573055c345752d0f343bba529

ism/src/ltdl.cpp

index 6223c93..5aecd6c 100644 (file)
@@ -2630,6 +2630,7 @@ foreach_dirinpath (
           goto cleanup;
       }
 
+      assert ((int)lendir > 0);
       assert (filenamesize > (int)lendir);
       strncpy (filename, dir_name, filenamesize);