diff options
| -rw-r--r-- | samples/seccomp/bpf-fancy.c | 4 | ||||
| -rw-r--r-- | samples/seccomp/bpf-helper.c | 6 |
2 files changed, 9 insertions, 1 deletions
diff --git a/samples/seccomp/bpf-fancy.c b/samples/seccomp/bpf-fancy.c index 8eb483aaec46..e8b24f443709 100644 --- a/samples/seccomp/bpf-fancy.c +++ b/samples/seccomp/bpf-fancy.c | |||
| @@ -25,7 +25,9 @@ | |||
| 25 | 25 | ||
| 26 | int main(int argc, char **argv) | 26 | int main(int argc, char **argv) |
| 27 | { | 27 | { |
| 28 | struct bpf_labels l; | 28 | struct bpf_labels l = { |
| 29 | .count = 0, | ||
| 30 | }; | ||
| 29 | static const char msg1[] = "Please type something: "; | 31 | static const char msg1[] = "Please type something: "; |
| 30 | static const char msg2[] = "You typed: "; | 32 | static const char msg2[] = "You typed: "; |
| 31 | char buf[256]; | 33 | char buf[256]; |
diff --git a/samples/seccomp/bpf-helper.c b/samples/seccomp/bpf-helper.c index 579cfe331886..05cb4d5ff9f5 100644 --- a/samples/seccomp/bpf-helper.c +++ b/samples/seccomp/bpf-helper.c | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | */ | 10 | */ |
| 11 | 11 | ||
| 12 | #include <stdio.h> | 12 | #include <stdio.h> |
| 13 | #include <stdlib.h> | ||
| 13 | #include <string.h> | 14 | #include <string.h> |
| 14 | 15 | ||
| 15 | #include "bpf-helper.h" | 16 | #include "bpf-helper.h" |
| @@ -63,6 +64,11 @@ __u32 seccomp_bpf_label(struct bpf_labels *labels, const char *label) | |||
| 63 | { | 64 | { |
| 64 | struct __bpf_label *begin = labels->labels, *end; | 65 | struct __bpf_label *begin = labels->labels, *end; |
| 65 | int id; | 66 | int id; |
| 67 | |||
| 68 | if (labels->count == BPF_LABELS_MAX) { | ||
| 69 | fprintf(stderr, "Too many labels\n"); | ||
| 70 | exit(1); | ||
| 71 | } | ||
| 66 | if (labels->count == 0) { | 72 | if (labels->count == 0) { |
| 67 | begin->label = label; | 73 | begin->label = label; |
| 68 | begin->location = 0xffffffff; | 74 | begin->location = 0xffffffff; |
