Download raw body.
readdir() checks for . and ..
decided to take a look due to other patches in other places :) out of these, the only place where I feel like the "." and ".." checks were missing is in write_tree() -- all the others use got_repo_is_packidx_filename() which will obviously fail for those entries. what do you think? diff /home/op/w/got path + /home/op/w/got commit - a068a093ed454b5cfd537a6916f6b32c18a541b6 blob - 8d2c4a28815971860618446c5701073d301b1ee6 file + lib/repository.c --- lib/repository.c +++ lib/repository.c @@ -1466,6 +1466,10 @@ got_repo_list_packidx(struct got_pathlist_head *packid repo->pack_path_mtime.tv_nsec = sb.st_mtim.tv_nsec; while ((dent = readdir(packdir)) != NULL) { + if (strcmp(dent->d_name, ".") == 0 || + strcmp(dent->d_name, "..") == 0) + continue; + if (!got_repo_is_packidx_filename(dent->d_name, dent->d_namlen, repo->algo)) continue; @@ -2404,6 +2408,10 @@ write_tree(struct got_object_id **new_tree_id, const c goto done; } + if (strcmp(de->d_name, ".") == 0 || + strcmp(de->d_name, "..") == 0) + continue; + err = got_path_dirent_type(&type, path_dir, de); if (err) goto done; @@ -2612,6 +2620,10 @@ got_repo_get_packfile_info(int *npackfiles, int *nobje } while ((dent = readdir(packdir)) != NULL) { + if (strcmp(dent->d_name, ".") == 0 || + strcmp(dent->d_name, "..") == 0) + continue; + if (!got_repo_is_packidx_filename(dent->d_name, dent->d_namlen, repo->algo)) continue; commit - a068a093ed454b5cfd537a6916f6b32c18a541b6 blob - 6bb4d83c2ec663c885893601aafb2d48f211c031 file + lib/repository_admin.c --- lib/repository_admin.c +++ lib/repository_admin.c @@ -1675,6 +1675,10 @@ got_repo_remove_lonely_packidx(struct got_repository * goto done; } + if (strcmp(dent->d_name, ".") == 0 || + strcmp(dent->d_name, "..") == 0) + continue; + if (!got_repo_is_packidx_filename(dent->d_name, dent->d_namlen, got_repo_get_object_format(repo))) continue;
readdir() checks for . and ..