Fix Svace issues WGID 143851, 152686, 152691
[apps/native/ug-wifi-direct.git] / popup-wifidirect / src / wfd-app-util.c
index 96ffea1..eb99384 100644 (file)
@@ -61,7 +61,7 @@ char *wfd_app_trim_path(const char *filewithpath)
        const char *space = "                                        ";
        int len = strlen(filewithpath);
 
-       if (len > 20) {
+       if (len >= 20) {
                strptr = (char *) filewithpath + (len - 20);
                start = 0;
        } else if (len < 20) {
@@ -70,7 +70,8 @@ char *wfd_app_trim_path(const char *filewithpath)
        }
 
        strncpy((char *) filename, space, strlen(space));
-       strncpy((char *) filename + start, strptr, 50);
+       if(strptr)
+               strncpy((char *) filename + start, strptr, 50);
 
        return (char *) filename;
 #endif