From: Benjamin Kaduk Date: Fri, 10 Jan 2014 03:42:26 +0000 (-0500) Subject: afs_fetchstore: avoid use of uninitialized variable X-Git-Tag: upstream/1.6.8^2~58 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=596b464d20150bbb816176cb278e2e9c845edecd;p=packages%2Fo%2Fopenafs.git afs_fetchstore: avoid use of uninitialized variable rxfs_fetchInit() attempts to do a 64-bit RPC first, but falls back to the 32-bit StartRXAFS_FetchData() if the server appears to not support the 64-bit RPCs. We correctly did not read a length from the call if the FetchData RPC(s) failed, but proceeded to assign from the 'length' local variable into the 'alength' output variable unconditionally later on. Instead of blindly continuing on, jump to the error-handling part of the routine when we cannot read a length from the call. This has the side effect of skipping an afs_Trace3() point in the error case. Reviewed-on: http://gerrit.openafs.org/10694 Reviewed-by: Derrick Brashear Tested-by: Benjamin Kaduk (cherry picked from commit baf6af8a8f2207ce39b746d59ca4bc661c002883) Change-Id: Icf14d5e8a6abf8a8a014ab7d48b767e3dcc7a6a9 Reviewed-on: http://gerrit.openafs.org/10742 Tested-by: BuildBot Reviewed-by: D Brashear Reviewed-by: Andrew Deason Reviewed-by: Stephan Wiesand --- diff --git a/src/afs/afs_fetchstore.c b/src/afs/afs_fetchstore.c index c05389c1f..49d02134c 100644 --- a/src/afs/afs_fetchstore.c +++ b/src/afs/afs_fetchstore.c @@ -968,7 +968,9 @@ rxfs_fetchInit(struct afs_conn *tc, struct rx_connection *rxconn, } afs_serverSetNo64Bit(tc); } - if (!code) { + if (code) { + goto err; + } else { RX_AFS_GUNLOCK(); bytes = rx_Read(v->call, (char *)&length, sizeof(afs_int32)); RX_AFS_GLOCK(); @@ -1026,6 +1028,7 @@ rxfs_fetchInit(struct afs_conn *tc, struct rx_connection *rxconn, code = EIO; } +err: if (!code && code1) code = code1;