- send_length= (size_t) snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
- "flush_all%s\r\n", no_reply ? " noreply" : "");
+ {
+ send_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
+ "flush_all%s\r\n", no_reply ? " noreply" : "");
+ }
+
+ if (send_length >= MEMCACHED_DEFAULT_COMMAND_SIZE || send_length < 0)
+ {
+ return MEMCACHED_FAILURE;
+ }