windows-pioctl-parse-path-20071018
authorJeffrey Altman <jaltman@secure-endpoints.com>
Fri, 19 Oct 2007 05:25:39 +0000 (05:25 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Fri, 19 Oct 2007 05:25:39 +0000 (05:25 +0000)
cm_ParseIoctlPath() moves the ioctlp->inDatap past the ioctl path
to the next data value if there is one.  Make sure we move the pointer
before we alter the contents of the buffer.  Otherwise, the caller
uses the wrong string for its next data blob.

src/WINNT/afsd/cm_ioctl.c

index e019ca5..71a2682 100644 (file)
@@ -201,10 +201,14 @@ long cm_ParseIoctlPath(smb_ioctl_t *ioctlp, cm_user_t *userp, cm_req_t *reqp,
     cm_scache_t *substRootp = NULL;
     cm_scache_t *iscp = NULL;
 #endif
-    char * relativePath = ioctlp->inDatap;
+    char * relativePath;
     char * lastComponent = NULL;
     afs_uint32 follow = 0;
 
+    relativePath = ioctlp->inDatap;
+    /* setup the next data value for the caller to use */
+    ioctlp->inDatap += (long)strlen(ioctlp->inDatap) + 1;;
+
     osi_Log1(afsd_logp, "cm_ParseIoctlPath %s", osi_LogSaveString(afsd_logp,relativePath));
 
     /* This is usually the file name, but for StatMountPoint it is the path. */
@@ -216,6 +220,9 @@ long cm_ParseIoctlPath(smb_ioctl_t *ioctlp, cm_user_t *userp, cm_req_t *reqp,
      */
     TranslateExtendedChars(relativePath);
 
+    /* This is usually nothing, but for StatMountPoint it is the file name. */
+    TranslateExtendedChars(ioctlp->inDatap);
+
 #ifdef AFSIFS
     /* we have passed the whole path, including the afs prefix.
        when the pioctl call is made, we perform an ioctl to afsrdr
@@ -370,13 +377,6 @@ long cm_ParseIoctlPath(smb_ioctl_t *ioctlp, cm_user_t *userp, cm_req_t *reqp,
     }
 #endif /* AFSIFS */
 
-    /* # of bytes of path */
-    code = (long)strlen(ioctlp->inDatap) + 1;
-    ioctlp->inDatap += code;
-
-    /* This is usually nothing, but for StatMountPoint it is the file name. */
-    TranslateExtendedChars(ioctlp->inDatap);
-
     if (substRootp)
        cm_ReleaseSCache(substRootp);