diff --git a/generic/bson.c b/generic/bson.c index 9a7e74d..48f38e0 100644 --- a/generic/bson.c +++ b/generic/bson.c @@ -745,9 +745,9 @@ mongotcl_create_bson_command (Tcl_Interp *interp, char *commandName, CONST bson static unsigned long nextAutoCounter = 0; int baseNameLength; - baseNameLength = strlen(commandName) + snprintf (NULL, 0, "%lu", nextAutoCounter) + 1; + baseNameLength = strlen("bson") + snprintf (NULL, 0, "%lu", nextAutoCounter) + 1; commandName = ckalloc (baseNameLength); - snprintf (commandName, baseNameLength, "%s%lu", commandName, nextAutoCounter++); + snprintf (commandName, baseNameLength, "bson%lu", nextAutoCounter++); autoGeneratedName = 1; } diff --git a/generic/cursor.c b/generic/cursor.c index 3bd705b..db57946 100644 --- a/generic/cursor.c +++ b/generic/cursor.c @@ -396,9 +396,9 @@ mongotcl_createCursorObjCmd(Tcl_Interp *interp, mongo *conn, char *commandName, static unsigned long nextAutoCounter = 0; int baseNameLength; - baseNameLength = strlen(commandName) + snprintf (NULL, 0, "%lu", nextAutoCounter) + 1; + baseNameLength = strlen("cursor") + snprintf (NULL, 0, "%lu", nextAutoCounter) + 1; commandName = ckalloc (baseNameLength); - snprintf (commandName, baseNameLength, "%s%lu", commandName, nextAutoCounter++); + snprintf (commandName, baseNameLength, "cursor%lu", nextAutoCounter++); autoGeneratedName = 1; }