TRIO_PUBLIC trio_pointer_t trio_register TRIO_ARGS2((callback, name), trio_callback_t callback,
                                                    TRIO_CONST char* name)
{
	trio_userdef_t* def;
	trio_userdef_t* prev = NULL;

	if (callback == NULL)
		return NULL;

	if (name)
	{
		/* Handle built-in namespaces */
		if (name[0] == ':')
		{
			if (trio_equal(name, ":enter"))
			{
				internalEnterCriticalRegion = callback;
			}
			else if (trio_equal(name, ":leave"))
			{
				internalLeaveCriticalRegion = callback;
			}
			return NULL;
		}

		/* Bail out if namespace is too long */
		if (trio_length_max(name, MAX_USER_NAME) >= MAX_USER_NAME)
			return NULL;

		/* Bail out if namespace already is registered */
		def = TrioFindNamespace(name, &prev);
		if (def)
			return NULL;
	}

	def = (trio_userdef_t*)TRIO_MALLOC(sizeof(trio_userdef_t));
	if (def)
	{
		if (internalEnterCriticalRegion)
			(void)internalEnterCriticalRegion(NULL);

		if (name)
		{
			/* Link into internal list */
			if (prev == NULL)
				internalUserDef = def;
			else
				prev->next = def;
		}
		/* Initialize */
		def->callback = callback;
		def->name = (name == NULL) ? NULL : trio_duplicate(name);
		def->next = NULL;

		if (internalLeaveCriticalRegion)
			(void)internalLeaveCriticalRegion(NULL);
	}
	return (trio_pointer_t)def;
}
The software performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control.