commit f54645a294a325bc9160002b6a07bc409e77efa86e75c13855835bae3d1eaf01 from: Stefan Sperling date: Sun Jan 5 08:51:26 2025 UTC check for errors from telldir(3); suggested by jamsek commit - 193493c397500353e3bc95bac96147419e56cf9893c1f21195adac1b795e82b6 commit + f54645a294a325bc9160002b6a07bc409e77efa86e75c13855835bae3d1eaf01 blob - 43290e79f5c7a684126eebeee49ac9b9e7707bf66c000b941219c61a2c96090a blob + 6762765badee3431b9efb47b0be6ef1c945c6fe38fa1ea09c40f39029e3e7fdc --- lib/repository.c +++ lib/repository.c @@ -2440,6 +2440,10 @@ write_tree(struct got_object_id **new_tree_id, const c * during import then we have a racy situation no matter what. */ pos = telldir(dir); + if (pos == -1) { + err = got_error_from_errno2("telldir", path_dir); + goto done; + } while ((de = readdir(dir)) != NULL) { if (strcmp(de->d_name, ".") != 0 && strcmp(de->d_name, "..") != 0) { @@ -2448,6 +2452,10 @@ write_tree(struct got_object_id **new_tree_id, const c goto done; } pos = telldir(dir); + if (pos == -1) { + err = got_error_from_errno2("telldir", path_dir); + goto done; + } } nentries = 0;