Fix off-by-one/heap-buffer-overflow as reported by ASAN.

It's probably not the best "solution" but it should hopefully be
one less category of crash-on-close on Mac.

ASAN a.k.a Clang "AddressSanitizer".
This commit is contained in:
follower
2017-11-07 22:23:34 +13:00
committed by Lukas W
parent 298f1ec335
commit eb09ff6f25

View File

@@ -615,7 +615,7 @@ char * MidiApple::getFullName(MIDIEndpointRef &endpoint_ref)
char * deviceName = getName(device);
char * endPointName = getName(endpoint_ref);
qDebug("device name='%s' endpoint name='%s'",deviceName,endPointName);
char * fullName = (char *)malloc(strlen(deviceName) + strlen(endPointName)+1);
char * fullName = (char *)malloc(strlen(deviceName) + strlen(":") + strlen(endPointName)+1);
sprintf(fullName, "%s:%s", deviceName,endPointName);
return fullName;
}