diff --git a/lib/oid_registry.c b/lib/oid_registry.c index 318f382a010d62f0f6b0c536ee038f41100e57cf..41b9e50711a72af31d7548d3aea5be1177a45a9d 100644 --- a/lib/oid_registry.c +++ b/lib/oid_registry.c @@ -142,9 +142,9 @@ int sprint_oid(const void *data, size_t datasize, char *buffer, size_t bufsize) } ret += count = snprintf(buffer, bufsize, ".%lu", num); buffer += count; - bufsize -= count; - if (bufsize == 0) + if (bufsize <= count) return -ENOBUFS; + bufsize -= count; } return ret;