b1047b
diff --git a/epan/dissectors/packet-distcc.c b/epan/dissectors/packet-distcc.c
b1047b
index 1478ca2f28..6ec20c5a2a 100644
b1047b
--- a/epan/dissectors/packet-distcc.c
b1047b
+++ b/epan/dissectors/packet-distcc.c
b1047b
@@ -266,7 +266,7 @@ dissect_distcc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
b1047b
     int offset=0;
b1047b
     proto_tree *tree=NULL;
b1047b
     proto_item *item=NULL;
b1047b
-    char token[4];
b1047b
+    char buf[13];
b1047b
     guint32 parameter;
b1047b
 
b1047b
 
b1047b
@@ -280,39 +280,33 @@ dissect_distcc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
b1047b
         tree = proto_item_add_subtree(item, ett_distcc);
b1047b
     }
b1047b
 
b1047b
-    while(1){
b1047b
-        /* we must have at least 12 bytes so we can read the
b1047b
-           token and the parameter */
b1047b
-        if(tvb_length_remaining(tvb, offset)<12){
b1047b
-            return;
b1047b
-        }
b1047b
-
b1047b
-        /* read the token */
b1047b
-        tvb_memcpy(tvb, token, offset, 4);
b1047b
-        offset+=4;
b1047b
+    while (TRUE) {
b1047b
+        /* read the raw token (4 bytes) and parameter (8 bytes) */
b1047b
+        tvb_memcpy(tvb, buf, offset, 12);
b1047b
+        buf[12] = '\0';
b1047b
+        offset+=12;
b1047b
 
b1047b
-        /* read the parameter */
b1047b
-        if (sscanf(tvb_get_ptr(tvb, offset, 8), "%08x", &parameter) != 1)
b1047b
+        /* scan the parameter */
b1047b
+        if (sscanf(buf + 4, "%08x", &parameter) != 1)
b1047b
             return;
b1047b
-        offset+=8;
b1047b
 
b1047b
-        if(!strncmp(token, "DIST", 4)){
b1047b
+        if(!strncmp(buf, "DIST", 4)){
b1047b
             offset=dissect_distcc_dist(tvb, pinfo, tree, offset, parameter);
b1047b
-        } else if(!strncmp(token, "ARGC", 4)){
b1047b
+        } else if(!strncmp(buf, "ARGC", 4)){
b1047b
             offset=dissect_distcc_argc(tvb, pinfo, tree, offset, parameter);
b1047b
-        } else if(!strncmp(token, "ARGV", 4)){
b1047b
+        } else if(!strncmp(buf, "ARGV", 4)){
b1047b
             offset=dissect_distcc_argv(tvb, pinfo, tree, offset, parameter);
b1047b
-        } else if(!strncmp(token, "DOTI", 4)){
b1047b
+        } else if(!strncmp(buf, "DOTI", 4)){
b1047b
             offset=dissect_distcc_doti(tvb, pinfo, tree, offset, parameter);
b1047b
-        } else if(!strncmp(token, "DONE", 4)){
b1047b
+        } else if(!strncmp(buf, "DONE", 4)){
b1047b
             offset=dissect_distcc_done(tvb, pinfo, tree, offset, parameter);
b1047b
-        } else if(!strncmp(token, "STAT", 4)){
b1047b
+        } else if(!strncmp(buf, "STAT", 4)){
b1047b
             offset=dissect_distcc_stat(tvb, pinfo, tree, offset, parameter);
b1047b
-        } else if(!strncmp(token, "SERR", 4)){
b1047b
+        } else if(!strncmp(buf, "SERR", 4)){
b1047b
             offset=dissect_distcc_serr(tvb, pinfo, tree, offset, parameter);
b1047b
-        } else if(!strncmp(token, "SOUT", 4)){
b1047b
+        } else if(!strncmp(buf, "SOUT", 4)){
b1047b
             offset=dissect_distcc_sout(tvb, pinfo, tree, offset, parameter);
b1047b
-        } else if(!strncmp(token, "DOTO", 4)){
b1047b
+        } else if(!strncmp(buf, "DOTO", 4)){
b1047b
             offset=dissect_distcc_doto(tvb, pinfo, tree, offset, parameter);
b1047b
         } else {
b1047b
             call_dissector(data_handle, tvb, pinfo, tree);