diff options
author | Andrew G. Morgan <morgan@kernel.org> | 2021-08-27 13:55:11 -0700 |
---|---|---|
committer | Andrew G. Morgan <morgan@kernel.org> | 2021-08-27 13:55:11 -0700 |
commit | de1130dbfe6d4ce99422b11cac147d39448bcd40 (patch) | |
tree | 61ba110f4fa18301740b582732dce6184a0d8038 /libcap | |
parent | b56400f81ddd42e0e57372c957e668e6d5a72834 (diff) | |
download | libcap2-de1130dbfe6d4ce99422b11cac147d39448bcd40.tar.gz |
Speculative fix for build failure.
Not sure exactly what is causing the build server to fail (can't
reproduce yet), but add some extra padding to a calloc and also
some test debugging printf()s.
Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
Diffstat (limited to 'libcap')
-rw-r--r-- | libcap/cap_alloc.c | 4 | ||||
-rw-r--r-- | libcap/cap_test.c | 7 |
2 files changed, 10 insertions, 1 deletions
diff --git a/libcap/cap_alloc.c b/libcap/cap_alloc.c index 5733e2f..ba2dd11 100644 --- a/libcap/cap_alloc.c +++ b/libcap/cap_alloc.c @@ -98,7 +98,11 @@ char *_libcap_strdup(const char *old) return NULL; } len = strlen(old) + 1 + 2*sizeof(__u32); + if (len < sizeof(struct _cap_alloc_s)) { + len = sizeof(struct _cap_alloc_s); + } if ((len & 0xffffffff) != len) { + _cap_debug("len is too long for libcap to manage"); errno = EINVAL; return NULL; } diff --git a/libcap/cap_test.c b/libcap/cap_test.c index 9fa7300..0beb45d 100644 --- a/libcap/cap_test.c +++ b/libcap/cap_test.c @@ -120,6 +120,8 @@ static int test_alloc(void) cap_launch_t launcher; char *old_root; + printf("test_alloc\n"); + c = cap_init(); if (c == NULL) { perror("failed to allocate a cap_t"); @@ -180,12 +182,14 @@ static int test_alloc(void) } drop_launcher: + printf("test_alloc: drop_launcher\n"); if (cap_free(launcher)) { perror("failed to free launcher"); retval = -1; } drop_iab: + printf("test_alloc: drop_iab\n"); if (!cap_free(2+(__u32 *) iab)) { printf("unable to recognize bad cap_iab_t pointer\n"); retval = -1; @@ -196,7 +200,8 @@ drop_iab: } drop_c: - if (!cap_free(1+(__u32 *)c)) { + printf("test_alloc: drop_cap\n"); + if (!cap_free(1+(__u32 *) c)) { printf("unable to recognize bad cap_t pointer\n"); retval = -1; } |