cloudflare / cloudflare/quiche

This function has file descriptor leaks;quiche/quiche/examples/server.c/gen_cid

Open
#1,242 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
11.8k
Forks
1.1k
Avg merge
21h 9m
Merged PRs (30d)
6

Description

static uint8_t *gen_cid(uint8_t *cid, size_t cid_len) {
int rng = open("/dev/urandom", O_RDONLY);
if (rng < 0) {
perror("failed to open /dev/urandom");
return NULL;
}

ssize_t rand_len = read(rng, cid, cid_len);
if (rand_len < 0) {
perror("failed to create connection ID");
return NULL;
}

return cid;
}
**you did't close the fd when your return**

Contributor guide

Open the contributing guide

Research direction

Open examples/server.c and inspect gen_cid, starting with its /dev/urandom open and both error and success returns. Confirm the file-descriptor lifetime and run the example's available build or test checks; done means the descriptor is released on every return path without changing the generated connection ID behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
networking
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.