]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Print the full attribute name on error
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 31 May 2018 18:21:44 +0000 (00:21 +0600)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 31 May 2018 18:21:44 +0000 (00:21 +0600)
src/lib/util/dict.c

index bfcd30f616b7cba0771fafbf3b46b871cf7f54d2..cfdc474bfeba7c35de0a4efc9ebb9ba4e9828dbe 100644 (file)
@@ -5458,19 +5458,17 @@ int fr_dict_global_init(TALLOC_CTX *ctx, char const *dict_dir)
  */
 ssize_t fr_dict_valid_name(char const *name, ssize_t len)
 {
-       uint8_t const *p = (uint8_t const *)name, *end;
+       char const *p = name, *end;
 
        if (len < 0) len = strlen(name);
        end = p + len;
 
        do {
                if (!fr_dict_attr_allowed_chars[(int)*p]) {
-                       char buff[5];
+                       fr_strerror_printf("Invalid character '%pV' in attribute name \"%pV\"",
+                                          fr_box_strvalue_len(p, 1), fr_box_strvalue_len(name, len));
 
-                       fr_snprint(buff, sizeof(buff), (char const *)p, 1, '\'');
-                       fr_strerror_printf("Invalid character '%s' in attribute name", buff);
-
-                       return -(p - (uint8_t const *)name);
+                       return -(p - name);
                }
                p++;
        } while (p < end);