camera: fix possible off-by-one with strncat()

This commit is contained in:
Pierre Pronchery 2024-07-29 19:33:12 +02:00
parent a0fb95977e
commit 4046248133

View File

@ -932,9 +932,9 @@ static void _properties_window(Camera * camera)
for(i = 0; capabilities[i].name != NULL; i++)
if(camera->cap.capabilities & capabilities[i].capability)
{
strncat(buf, sep, sizeof(buf) - strlen(buf));
strncat(buf, sep, sizeof(buf) - strlen(buf) - 1);
strncat(buf, capabilities[i].name, sizeof(buf)
- strlen(buf));
- strlen(buf) - 1);
sep = ", ";
}
buf[sizeof(buf) - 1] = '\0';