struct rspamd_result *res = NULL;
g_assert (client != NULL);
+ g_assert (length > 0);
/* Connect to server */
c = rspamd_connect_random_server (FALSE, err);
}
return NULL;
}
+ if (st.st_size == 0) {
+ if (*err == NULL) {
+ *err = g_error_new (G_RSPAMD_ERROR, -1, "File has zero length");
+ }
+ return NULL;
+ }
/* Set socket blocking for writing */
make_socket_blocking (c->socket);
/* Send command */
static const gchar ok_str[] = "learn ok";
g_assert (client != NULL);
+ g_assert (length > 0);
/* Connect to server */
c = rspamd_connect_random_server (TRUE, err);
}
return FALSE;
}
+ if (st.st_size == 0) {
+ if (*err == NULL) {
+ *err = g_error_new (G_RSPAMD_ERROR, -1, "File has zero length");
+ }
+ return FALSE;
+ }
r = sizeof ("learn %s %uz\r\n") + strlen (symbol) + sizeof ("4294967296");
outbuf = g_malloc (r);
r = snprintf (outbuf, r, "learn %s %lu\r\n", symbol, (unsigned long)st.st_size);
static const gchar ok_str[] = "OK";
g_assert (client != NULL);
+ g_assert (length > 0);
/* Connect to server */
c = rspamd_connect_random_server (TRUE, err);
}
return FALSE;
}
+ if (st.st_size == 0) {
+ if (*err == NULL) {
+ *err = g_error_new (G_RSPAMD_ERROR, -1, "File has zero length");
+ }
+ return FALSE;
+ }
r = sizeof ("fuzzy_add %uz %d %d\r\n") + sizeof ("4294967296") * 3;
outbuf = g_malloc (r);
if (delete) {