- char *buffer = new char[strlen("mmdb:LOCATOR=") + strlen(locator) + 1];
- sprintf (buffer, "mmdb:LOCATOR=%s", locator);
+ bufferlen = strlen("mmdb:LOCATOR=") + strlen(locator) + 1;
+ char *buffer = new char[bufferlen];
+ snprintf (buffer, bufferlen, "mmdb:LOCATOR=%s", locator);