From: Jeffrey Hutzelman Date: Mon, 3 Sep 2007 04:58:40 +0000 (+0000) Subject: dafs-savestatefe-avoid-overflow-20070902 X-Git-Tag: BP-openafs-windows-kdfs-ifs~508 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=edaa34d3a0ea74bffd886ec40e1c13af7c38a4af;p=packages%2Fo%2Fopenafs.git dafs-savestatefe-avoid-overflow-20070902 The problem is that cb_stateSaveFE() overflows an iovec array on its stack. When it returns, the PC is loaded with garbage and the process crashes. --- diff --git a/src/viced/callback.c b/src/viced/callback.c index 0a8075a80..ebb2c8660 100644 --- a/src/viced/callback.c +++ b/src/viced/callback.c @@ -2352,8 +2352,8 @@ cb_stateSaveFE(struct fs_dump_state * state, struct FileEntry * fe) goto done; } cbdsk[idx].index = cbi; - iov[idx].iov_base = (char *)&cbdsk[idx]; - len += iov[idx].iov_len = sizeof(struct CBDiskEntry); + iov[iovcnt].iov_base = (char *)&cbdsk[idx]; + len += iov[iovcnt].iov_len = sizeof(struct CBDiskEntry); iovcnt++; if ((iovcnt == 16) || (!cb->cnext)) { if (fs_stateWriteV(state, iov, iovcnt)) {