windows-pioctl-listlink-20071222
authorJeffrey Altman <jaltman@secure-endpoints.com>
Sun, 23 Dec 2007 03:43:49 +0000 (03:43 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Sun, 23 Dec 2007 03:43:49 +0000 (03:43 +0000)
LICENSE MIT

In the error case (1) reference the mountPointString instead of the
output of cm_AssembleLink() which was not generated and (2) do not
free memory and objects that were not allocated nor reference counted.

src/WINNT/afsd/cm_ioctl.c

index 72f3090..c5ce570 100644 (file)
@@ -1904,13 +1904,11 @@ long cm_IoctlListlink(struct smb_ioctl *ioctlp, struct cm_user *userp)
                 scp->fileType == CM_SCACHETYPE_DFSLINK ||
                code == CM_ERROR_NOSUCHPATH &&
                 scp->fileType == CM_SCACHETYPE_INVALID) {
+
         cp = ioctlp->outDatap;
-        StringCbCopyA(cp, SMB_IOCTL_MAXDATA - (cp - ioctlp->outAllocp), spacep->data);
+        StringCbCopyA(cp, SMB_IOCTL_MAXDATA - (cp - ioctlp->outAllocp), scp->mountPointStringp);
         cp += strlen(cp) + 1;
         ioctlp->outDatap = cp;
-        cm_FreeSpace(spacep);
-        if (newRootScp != NULL)
-            cm_ReleaseSCache(newRootScp);
         code = 0;
     }