Better printing of octets
authoraland <aland>
Wed, 3 May 2006 17:34:48 +0000 (17:34 +0000)
committeraland <aland>
Wed, 3 May 2006 17:34:48 +0000 (17:34 +0000)
src/lib/filters.c

index 31a503c..233eff9 100644 (file)
@@ -1167,9 +1167,11 @@ void print_abinary(VALUE_PAIR *vp, char *buffer, int len)
   if (vp->length != sizeof(*filter)) {
          strcpy(p, "0x");
          p += 2;
+         len -= 2;
          for (i = 0; i < vp->length; i++) {
-                 sprintf(p, " %02x", vp->vp_octets[i]);
-                 p += 3;
+                 snprintf(p, len, "%02x", vp->vp_octets[i]);
+                 p += 2;
+                 len -= 2;
          }
          return;
   }