Conversation
The `strncpy` function was used to copy usernames into fixed-size buffers (`MAXUSERLEN`) in `tphrase.c` and `t_client.c` without explicitly bounding to `MAXUSERLEN - 1` and adding a null terminator. If a username larger than the buffer is provided, the buffer will lack a null terminator, leading to potential out-of-bounds reads or writes during subsequent string operations. This commit updates `tphrase.c` and `t_client.c` to safely bound the copy to `MAXUSERLEN - 1` and explicitly append a null byte. Signed-off-by: Jules Sentinel <jules@example.com> Co-authored-by: manupawickramasinghe <73810867+manupawickramasinghe@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
The `strncpy` function was used to copy usernames into fixed-size buffers (`MAXUSERLEN`) in `tphrase.c` and `t_client.c` without explicitly bounding to `MAXUSERLEN - 1` and adding a null terminator. If a username larger than the buffer is provided, the buffer will lack a null terminator, leading to potential out-of-bounds reads or writes during subsequent string operations. This commit updates `tphrase.c` and `t_client.c` to safely bound the copy to `MAXUSERLEN - 1` and explicitly append a null byte. Additionally, this commit updates `.github/workflows/build.yml` to update the apt sources for the outdated Debian Buster container used in CI, pointing it to `archive.debian.org` to prevent 404 Not Found errors during the `apt-get update` step. Signed-off-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: manupawickramasinghe <73810867+manupawickramasinghe@users.noreply.github.com>
The `strncpy` function was used to copy usernames into fixed-size buffers (`MAXUSERLEN`) in `tphrase.c` and `t_client.c` without explicitly bounding to `MAXUSERLEN - 1` and adding a null terminator. If a username larger than the buffer is provided, the buffer will lack a null terminator, leading to potential out-of-bounds reads or writes during subsequent string operations. This commit updates `tphrase.c` and `t_client.c` to safely bound the copy to `MAXUSERLEN - 1` and explicitly append a null byte. Additionally, this commit updates `.github/workflows/build.yml` to update the apt sources for the outdated Debian Buster container used in CI, pointing it to `archive.debian.org` to prevent 404 Not Found errors during the `apt-get update` step. Signed-off-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: manupawickramasinghe <73810867+manupawickramasinghe@users.noreply.github.com>
The `strncpy` function was used to copy usernames into fixed-size buffers (`MAXUSERLEN`) in `tphrase.c` and `t_client.c` without explicitly bounding to `MAXUSERLEN - 1` and adding a null terminator. If a username larger than the buffer is provided, the buffer will lack a null terminator, leading to potential out-of-bounds reads or writes during subsequent string operations. This commit updates `tphrase.c` and `t_client.c` to safely bound the copy to `MAXUSERLEN - 1` and explicitly append a null byte. Additionally, this commit updates `.github/workflows/build.yml` to update the apt sources for the outdated Debian Buster container used in CI, pointing it to `archive.debian.org` to prevent 404 Not Found errors during the `apt-get update` step. Signed-off-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: manupawickramasinghe <73810867+manupawickramasinghe@users.noreply.github.com>
The `strncpy` function was used to copy usernames into fixed-size buffers (`MAXUSERLEN`) in `tphrase.c` and `t_client.c` without explicitly bounding to `MAXUSERLEN - 1` and adding a null terminator. If a username larger than the buffer is provided, the buffer will lack a null terminator, leading to potential out-of-bounds reads or writes during subsequent string operations. This commit updates `tphrase.c` and `t_client.c` to safely bound the copy to `MAXUSERLEN - 1` and explicitly append a null byte. Additionally, this commit updates `.github/workflows/build.yml` and `.github/workflows/check-kernel-patches.yml` to update the apt sources for the outdated Debian Buster container used in CI, pointing it to `archive.debian.org` to prevent 404 Not Found errors during the `apt-get update` step, and includes `python3-pyelftools` to satisfy new build dependencies. Signed-off-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: manupawickramasinghe <73810867+manupawickramasinghe@users.noreply.github.com>
…ctions CI 404 The `strncpy` function was used to copy usernames into fixed-size buffers (`MAXUSERLEN`) in `tphrase.c` and `t_client.c` without explicitly bounding to `MAXUSERLEN - 1` and adding a null terminator. If a username larger than the buffer is provided, the buffer will lack a null terminator, leading to potential out-of-bounds reads or writes during subsequent string operations. This commit updates `tphrase.c` and `t_client.c` to safely bound the copy to `MAXUSERLEN - 1` and explicitly append a null byte. Additionally, this commit updates `.github/workflows/build.yml` and `.github/workflows/check-kernel-patches.yml` to update the apt sources for the outdated Debian Buster container used in CI, pointing it to `archive.debian.org` to prevent 404 Not Found errors during the `apt-get update` step, and includes `python3-pyelftools` to satisfy new build dependencies. Signed-off-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: manupawickramasinghe <73810867+manupawickramasinghe@users.noreply.github.com>
🚨 Severity: HIGH
💡 Vulnerability: The
strncpyfunction inpackage/network/services/ead/src/tinysrp/tphrase.candt_client.cwas used to copy usernames into fixed-size buffers (MAXUSERLEN) without explicitly bounding the copy toMAXUSERLEN - 1and adding a null terminator.strncpydoes not guarantee null-termination if the source string length is equal to or greater than the specified bound.🎯 Impact: If a username larger than the buffer is provided (or parsed from a file), the resulting buffer will lack a null terminator. This can lead to out-of-bounds reads or writes during subsequent string operations (like
strlen,strcpy, or when used as format strings), potentially leading to crashes, information disclosure, or memory corruption.🔧 Fix: Bounded the
strncpycopies toMAXUSERLEN - 1and explicitly set the null terminator atbuffer[MAXUSERLEN - 1] = '\0'immediately following the copy.✅ Verification: Verified that the fix compiles correctly by manually building the
eadservice viamake -C package/network/services/ead/src. The codebase was cleaned of build artifacts.Also added a journal entry to
.jules/sentinel.mddocumenting this learning.PR created automatically by Jules for task 7084194960663180766 started by @manupawickramasinghe