Index: /trunk/src/VBox/Main/src-client/GuestCtrlIO.cpp
===================================================================
--- /trunk/src/VBox/Main/src-client/GuestCtrlIO.cpp	(revision 39790)
+++ /trunk/src/VBox/Main/src-client/GuestCtrlIO.cpp	(revision 39791)
@@ -355,10 +355,12 @@
     int rc = VINF_SUCCESS;
 
-    char *pszOff   = (char*)&m_pbBuffer[m_cbOffset];
-    char *pszStart = pszOff;
+    char    *pszOff    = (char*)&m_pbBuffer[m_cbOffset];
+    char    *pszStart  = pszOff;
+    uint32_t uDistance;
     while (*pszStart)
     {
         size_t pairLen = strlen(pszStart);
-        if ((pszStart - pszOff) + pairLen + 1 >= m_cbSize)
+        uDistance = (pszStart - pszOff);
+        if (m_cbOffset + uDistance + pairLen + 1 >= m_cbSize)
         {
             rc = VERR_MORE_DATA;
@@ -393,5 +395,5 @@
      * in our buffer just skip the current termination so that
      * we can try next time. */
-    uint32_t uDistance = (pszStart - pszOff);
+    uDistance = (pszStart - pszOff);
     if (   !uDistance
         && *pszStart == '\0'
