]> granicus.if.org Git - json-c/commitdiff
json_type_to_name(): use correct printf() formatter
authorEven Rouault <even.rouault@spatialys.com>
Sun, 16 Jan 2022 19:48:27 +0000 (20:48 +0100)
committerEven Rouault <even.rouault@spatialys.com>
Sun, 30 Jan 2022 23:27:41 +0000 (00:27 +0100)
Was detected by Coverity Scan when analyzing GDAL's code base which has
a copy of json-c

json_util.c

index 4312458c58f5bfb50a8084f303b9b2624b93f641..a65adc04b9e5cf4a45d69045705808502db3e94f 100644 (file)
@@ -288,8 +288,8 @@ const char *json_type_to_name(enum json_type o_type)
        int o_type_int = (int)o_type;
        if (o_type_int < 0 || o_type_int >= (int)NELEM(json_type_name))
        {
-               _json_c_set_last_err("json_type_to_name: type %d is out of range [0,%d]\n", o_type,
-                                    NELEM(json_type_name));
+               _json_c_set_last_err("json_type_to_name: type %d is out of range [0,%u]\n", o_type,
+                                    (unsigned)NELEM(json_type_name));
                return NULL;
        }
        return json_type_name[o_type];