- count= sprintf(end_ptr, "localhost:%u,", port);
+ int count;
+ size_t remaining_length= sizeof(server_string_buffer) - (size_t)(end_ptr -server_string_buffer);
+ count= snprintf(end_ptr, remaining_length, "localhost:%u,", port);
+
+ if ((size_t)count >= remaining_length || count < 0)
+ {
+ fprintf(stderr, "server names grew to be larger then buffer allowed\n");
+ abort();
+ }