sprintf_s com um buffer muito pequeno

O código a seguir causa um erro e mata o meu aplicativo. Faz sentido, pois o buffer tem apenas 10 bytes e o texto tem 22 bytes (buffer overflow).

char buffer[10];    
int length = sprintf_s( buffer, 10, "1234567890.1234567890." ); 

Como obtenho esse erro para que eu possa denunciá-lo em vez de bloquear meu aplicativo?

Editar:

Depois de ler os comentários abaixo eu fui com _snprintf_s. Se ele retornar um valor -1, o buffer não foi atualizado.

length = _snprintf_s( buffer, 10, 9, "123456789" );
printf( "1) Length=%d\n", length ); // Length == 9

length = _snprintf_s( buffer, 10, 9, "1234567890.1234567890." );
printf( "2) Length=%d\n", length ); // Length == -1

length = _snprintf_s( buffer, 10, 10, "1234567890.1234567890." );
printf( "3) Length=%d\n", length ); // Crash, it needs room for the NULL char 

questionAnswers(6)

yourAnswerToTheQuestion