File tree 1 file changed +10
-0
lines changed
1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,9 @@ DIR *opendir(const char *dir)
33
33
}
34
34
35
35
filespec = (char * )malloc (strlen (resolved_path_buff ) + 2 + 1 );
36
+ if (filespec == NULL ) {
37
+ return NULL ;
38
+ }
36
39
strcpy (filespec , resolved_path_buff );
37
40
index = strlen (filespec ) - 1 ;
38
41
if (index >= 0 && (filespec [index ] == '/' ||
@@ -41,6 +44,9 @@ DIR *opendir(const char *dir)
41
44
strcat (filespec , "\\*" );
42
45
43
46
dp = (DIR * ) malloc (sizeof (DIR ));
47
+ if (dp == NULL ) {
48
+ return NULL ;
49
+ }
44
50
dp -> offset = 0 ;
45
51
dp -> finished = 0 ;
46
52
@@ -140,6 +146,10 @@ int rewinddir(DIR *dp)
140
146
dp -> finished = 0 ;
141
147
142
148
filespec = (char * )malloc (strlen (dp -> dir ) + 2 + 1 );
149
+ if (filespec == NULL ) {
150
+ return -1 ;
151
+ }
152
+
143
153
strcpy (filespec , dp -> dir );
144
154
index = strlen (filespec ) - 1 ;
145
155
if (index >= 0 && (filespec [index ] == '/' ||
You can’t perform that action at this time.
0 commit comments