From: Simon Wilkinson Date: Tue, 26 Feb 2013 21:30:20 +0000 (+0000) Subject: bos_util: Fix buffer overflow X-Git-Tag: openafs-stable-1_8_0pre1~1400 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=debf43714b0f00fa00a0ef3384e098de78d28ed6 bos_util: Fix buffer overflow Get rid of a buffer overflow in the bos_util utility, by just printing the key from the 'tbuffer' string, rather than copying it into 'x' which is too small for it. Change-Id: Ia364fb63edb9e40a887e77aad833689a99b4ea7c Reviewed-on: http://gerrit.openafs.org/9291 Tested-by: BuildBot Reviewed-by: Derrick Brashear Reviewed-by: Jeffrey Altman --- diff --git a/src/bozo/bos_util.c b/src/bozo/bos_util.c index 2a7e62a..62293a2 100644 --- a/src/bozo/bos_util.c +++ b/src/bozo/bos_util.c @@ -180,13 +180,11 @@ main(int argc, char **argv) for (i = 0; i < tkeys.nkeys; i++) { if (tkeys.key[i].kvno != -1) { int count; - unsigned char x[8]; memcpy(tbuffer, tkeys.key[i].key, 8); tbuffer[8] = 0; printf("kvno %4d: key is '%s' '", tkeys.key[i].kvno, tbuffer); - strcpy((char *)x, (char *)tbuffer); for (count = 0; count < 8; count++) - printf("\\%03o", x[count]); + printf("\\%03o", tbuffer[count]); printf("'\n"); } }