Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not overflow local buffer #1909

Merged
merged 1 commit into from Nov 14, 2018
Merged

Conversation

isimluk
Copy link
Contributor

@isimluk isimluk commented Nov 13, 2018

Do not use full width of buf, as we intend to assign

buf[num_read] = '\0';

at the end of the buffer, afterwards. In case we have just read full BUF_SIZE,
we will write '\0' to a memory location that is outside of buf. This can be
referred to as CWE-119 although, it seems pretty harmless in this case.

Signed-off-by: Šimon Lukašík isimluk@fedoraproject.org

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Nov 13, 2018
@k8s-ci-robot
Copy link
Contributor

Hi @isimluk. Thanks for your PR.

I'm waiting for a kubernetes-sigs or kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Nov 13, 2018
@openshift-ci-robot
Copy link

Hi @isimluk. Thanks for your PR.

I'm waiting for a kubernetes-sigs or openshift member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@isimluk
Copy link
Contributor Author

isimluk commented Nov 13, 2018

Same as containers/conmon#5

Let me know if there is another project bundling this.

@runcom
Copy link
Member

runcom commented Nov 13, 2018

/test all

@openshift-ci-robot
Copy link

openshift-ci-robot commented Nov 13, 2018

@isimluk: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
ci/kata-jenkins bbce1b4 link /test kata-containers

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@giuseppe
Copy link
Member

LGTM

@runcom
Copy link
Member

runcom commented Nov 14, 2018

cfmt is failing a check with:

@@ -1679,7 +1679,7 @@ int main(int argc, char *argv[])
 			 * Read from container stderr for any error and send it to parent
 			 * We send -1 as pid to signal to parent that create container has failed.
 			 */
-			num_read = read(masterfd_stderr, buf, BUF_SIZE -1);
+			num_read = read(masterfd_stderr, buf, BUF_SIZE - 1);
 			if (num_read > 0) {
 				buf[num_read] = '\0';
 				write_sync_fd(sync_pipe_fd, -1, buf);
make: *** [cfmt] Error 1
The command "make fmt" exited with 2.

@isimluk can you fix that?

Do not use full width of buf, as we intend to assign

    buf[num_read] = '\0';

at the end of the buffer, afterwards. In case we have just read full BUF_SIZE,
we will write '\0' to a memory location that is outside of buf. This can be
referred to as CWE-119 although, it seems pretty harmless in this case.

Signed-off-by: Šimon Lukašík <isimluk@fedoraproject.org>
@mrunalp
Copy link
Member

mrunalp commented Nov 14, 2018

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 14, 2018
@mrunalp
Copy link
Member

mrunalp commented Nov 14, 2018

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 14, 2018
@mrunalp
Copy link
Member

mrunalp commented Nov 14, 2018

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: isimluk, mrunalp

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 14, 2018
@k8s-ci-robot k8s-ci-robot merged commit 4a36089 into cri-o:master Nov 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants