File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -105,13 +105,31 @@ inline void _splitpath (
105
105
strcpy (drive, " " );
106
106
107
107
if (dir) {
108
- strcpy (dir, dirname (tmp));
108
+ char tmp_dir[PATH_MAX] = {0 };
109
+ strcpy (tmp_dir, tmp); // W/A for fname broking
110
+ strcpy (dir, dirname (tmp_dir)); // This eval modify dirname argument!!!
109
111
if (dir[0 ] && dir[strlen (dir) - 1 ] != ' /' )
110
112
strcat (dir, " /" );
111
113
}
112
114
113
115
if (fname)
116
+ {
114
117
strcpy (fname, basename (tmp));
118
+ char *pos = strrchr (fname, ' .' );
119
+ if (pos != NULL )
120
+ *pos = 0 ;
121
+ }
122
+
123
+ if (ext)
124
+ {
125
+ char tmp_ext[NAME_MAX] = { 0 };
126
+ strcpy (tmp_ext, basename (tmp));
127
+ char *pos = strrchr (fname, ' .' );
128
+ if (pos != NULL )
129
+ strcpy (ext, pos + 1 );
130
+ else
131
+ strcpy (ext, " " );
132
+ }
115
133
}
116
134
117
135
#include < iostream>
You can’t perform that action at this time.
0 commit comments