From debf43714b0f00fa00a0ef3384e098de78d28ed6 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Tue, 26 Feb 2013 21:30:20 +0000 Subject: [PATCH] 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 --- src/bozo/bos_util.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/bozo/bos_util.c b/src/bozo/bos_util.c index 2a7e62af2..62293a270 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"); } } -- 2.39.5