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 | |
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>
-rw-r--r-- | Make.Rules | 11 | ||||
-rw-r--r-- | libcap/cap_alloc.c | 4 | ||||
-rw-r--r-- | libcap/cap_test.c | 7 |
3 files changed, 16 insertions, 6 deletions
@@ -54,7 +54,8 @@ GOPKGDIR=$(prefix)/share/gocode/src # From here on out, the Go module packages should always remain # backwardly compatible. I will only resort to using major version 2 # etc if Go's syntax dramatically changes in a backwards incompatible -# manner. (Let's hope not.) +# manner. (Let's hope not. If that happens, I'll also drop deprecated +# API functions.) GOMAJOR=1 # Compilation specifics @@ -152,11 +153,11 @@ endif # # make RAISE_SETFCAP=yes install # -# This is now defaulted to no because some distributions have started -# shipping with all users blessed with full inheritable sets which makes -# no sense whatsoever! +# This is now defaulted to no because some distributions started +# shipping with all users blessed with full inheritable sets which +# makes no sense whatsoever! # -# Indeed, it looks alarmingly like these distributions are recreating +# Indeed, it looked alarmingly like these distributions were recreating # the environment for what became known as the sendmail-capabilities # bug from 2000: # 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; } |