From: Simon Wilkinson Date: Tue, 26 Feb 2013 21:30:20 +0000 (+0000) Subject: bos_util: Fix buffer overflow X-Git-Tag: upstream/1.6.10_pre1^2~172 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=2ae05022bfd083f2095565636ab0251ff5204a85;p=packages%2Fo%2Fopenafs.git 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. Reviewed-on: http://gerrit.openafs.org/9291 Tested-by: BuildBot Reviewed-by: Derrick Brashear Reviewed-by: Jeffrey Altman (cherry picked from commit debf43714b0f00fa00a0ef3384e098de78d28ed6) Change-Id: If8b075691defeded972d0eff29b7fb594680e433 Reviewed-on: http://gerrit.openafs.org/11018 Reviewed-by: Nathaniel Filardo Reviewed-by: Andrew Deason Tested-by: BuildBot Reviewed-by: Chas Williams - CONTRACTOR Reviewed-by: Benjamin Kaduk Reviewed-by: Stephan Wiesand --- diff --git a/src/bozo/bos_util.c b/src/bozo/bos_util.c index 5847ab008..8c51fa403 100644 --- a/src/bozo/bos_util.c +++ b/src/bozo/bos_util.c @@ -185,13 +185,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"); } }