Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/RMerl/asuswrt-merlin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Sauvageau <rmerl@lostrealm.ca>2018-03-12 06:43:10 +0300
committerEric Sauvageau <rmerl@lostrealm.ca>2018-03-12 06:43:10 +0300
commit529096f9df34fcb04a7ef37dd4922c75de2225ef (patch)
tree7d6223fa059ec0039a7084ab180dc2d6a710add5 /release
parent4ef86659ffdebdcbf4318a798feb871d7132f18f (diff)
httpd: check that opendir() succeeded, otherwise httpd would crash
Diffstat (limited to 'release')
-rw-r--r--release/src/router/httpd/web.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/release/src/router/httpd/web.c b/release/src/router/httpd/web.c
index 6c84a41252..fd5ceb7cc8 100644
--- a/release/src/router/httpd/web.c
+++ b/release/src/router/httpd/web.c
@@ -14185,7 +14185,11 @@ ej_get_upload_icon_count_list(int eid, webs_t wp, int argc, char **argv) {
mkdir(JFFS_USERICON, 0755);
//Write /jffs/usericon/ file count and list
- dirp = opendir(JFFS_USERICON); /* There should be error handling after this */
+ dirp = opendir(JFFS_USERICON);
+ if (!dirp) {
+ return 0;
+ }
+
while ((entry = readdir(dirp)) != NULL) {
if (entry->d_type == DT_REG) { /* If the entry is a regular file */
strcat(allMacList, entry->d_name);