OPENAFS-SA-2018-002 butc: prevent TC_ReadLabel information leak
authorMark Vitale <mvitale@sinenomine.net>
Tue, 26 Jun 2018 09:00:25 +0000 (05:00 -0400)
committerBenjamin Kaduk <kaduk@mit.edu>
Mon, 10 Sep 2018 01:53:25 +0000 (20:53 -0500)
TC_ReadLabel (backup readlabel) does not initialize its output buffer
completely.  It leaks butc memory contents over the wire:

struct tc_tapeLabel
- up to 32 bytes from member afsname (TC_MAXTAPELEN 32)
- up to 32 bytes from member pname (TC_MAXTAPELEN 32)

Initialize the buffer.

[kaduk@mit.edu: move initialization to the RPC stub]

(cherry picked from commit 52f4d63148323e7d605f9194ff8c1549756e654b)

(cherry picked from commit b7e53b9e9706d63215a1804ed9eca30d69461f03)

Change-Id: I606fcf5afdb176cb4a2ca7bff0a56761b7ae2d48

src/butc/tcprocs.c

index 9efcbe8..17e6011 100644 (file)
@@ -388,6 +388,7 @@ STC_ReadLabel(struct rx_call *acid, struct tc_tapeLabel *label, afs_uint32 *task
 {
     afs_int32 code;
 
+    memset(label, 0, sizeof(*label));
 #ifdef xbsa
     if (CONF_XBSA)
        return (TC_BADTASK);    /* ReadLabel does not apply if XBSA */