|
|
@@ -278,9 +278,12 @@ static int read_uidgid_files_into_objdb(
|
|
|
if (dp == NULL)
|
|
|
return 0;
|
|
|
|
|
|
- len = offsetof(struct dirent, d_name) +
|
|
|
- pathconf(dirname, _PC_NAME_MAX) + 1;
|
|
|
+ len = offsetof(struct dirent, d_name) + NAME_MAX + 1;
|
|
|
+
|
|
|
entry = malloc(len);
|
|
|
+ if (entry == NULL) {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
|
|
|
for (return_code = readdir_r(dp, entry, &dirent);
|
|
|
dirent != NULL && return_code == 0;
|
|
|
@@ -331,9 +334,12 @@ static int read_service_files_into_objdb(
|
|
|
if (dp == NULL)
|
|
|
return 0;
|
|
|
|
|
|
- len = offsetof(struct dirent, d_name) +
|
|
|
- pathconf(dirname, _PC_NAME_MAX) + 1;
|
|
|
+ len = offsetof(struct dirent, d_name) + NAME_MAX + 1;
|
|
|
+
|
|
|
entry = malloc(len);
|
|
|
+ if (entry == NULL) {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
|
|
|
for (return_code = readdir_r(dp, entry, &dirent);
|
|
|
dirent != NULL && return_code == 0;
|