Move to snprintf. Change to use vp_octets, which is unsigned
authoraland <aland>
Thu, 22 Nov 2007 15:37:51 +0000 (15:37 +0000)
committeraland <aland>
Thu, 22 Nov 2007 15:37:51 +0000 (15:37 +0000)
src/lib/print.c

index 758485b..abebd27 100644 (file)
@@ -315,7 +315,8 @@ int vp_prints_value(char * out, int outlen, VALUE_PAIR *vp, int delimitst)
                        a = inet_ntop(AF_INET6, &addr, buf, sizeof(buf));
                        if (a) {
                                char *p = buf + strlen(buf);
-                               sprintf(p, "/%u", (unsigned int) vp->vp_strvalue[1]);
+                               snprintf(p, buf + sizeof(buf) - p - 1, "/%u",
+                                        (unsigned int) vp->vp_octets[1]);
                        }
                }
                        break;