]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Check for possible value truncation when calling vp_prints_value
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 26 Oct 2011 09:44:35 +0000 (11:44 +0200)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 26 Oct 2011 09:44:35 +0000 (11:44 +0200)
This should be fixed in future by performing the checks in vp_prints_value

src/lib/print.c

index a0d4498484c8a794a8d748af2a77cd19314e1a71..0bc5c592aaaaa6d9989cd50dd215188a590b3496 100644 (file)
@@ -432,7 +432,10 @@ int vp_prints_value_json(char *buffer, size_t bufsize, const VALUE_PAIR *vp)
                        break;
 
                default:
-                       p += vp_prints_value(p, bufsize, vp, 0);
+                       s = vp_prints_value(p, bufsize, vp, 0);
+                       if ((unsigned) s == (bufsize - 1)) return -1;
+                       
+                       p += s;
                        break;
        }