Skip to content

Commit 529096f

Browse files
committed
httpd: check that opendir() succeeded, otherwise httpd would crash
1 parent 4ef8665 commit 529096f

File tree

1 file changed

+5
-1
lines changed
  • release/src/router/httpd

1 file changed

+5
-1
lines changed

release/src/router/httpd/web.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -14185,7 +14185,11 @@ ej_get_upload_icon_count_list(int eid, webs_t wp, int argc, char **argv) {
1418514185
mkdir(JFFS_USERICON, 0755);
1418614186

1418714187
//Write /jffs/usericon/ file count and list
14188-
dirp = opendir(JFFS_USERICON); /* There should be error handling after this */
14188+
dirp = opendir(JFFS_USERICON);
14189+
if (!dirp) {
14190+
return 0;
14191+
}
14192+
1418914193
while ((entry = readdir(dirp)) != NULL) {
1419014194
if (entry->d_type == DT_REG) { /* If the entry is a regular file */
1419114195
strcat(allMacList, entry->d_name);

0 commit comments

Comments
 (0)