diff --git a/src/main.c b/src/main.c index beebc0c..47d23ca 100644 --- a/src/main.c +++ b/src/main.c @@ -134,18 +134,18 @@ int main(int argc, char *argv[]) { if(img->width == 320 && img->height == 50) { - dprintf("autodetecting phpBB captcha\n"); + dprintf("autodetected phpBB captcha\n"); result = decode_phpbb(img); } else if((img->height == 25 || img->height == 30) && count < 10) { - dprintf("autodetecting scode captcha\n"); + dprintf("autodetected scode captcha\n"); result = decode_scode(img); } else if(img->height == 69) { - dprintf("autodetecting slashdot captcha\n"); + dprintf("autodetected slashdot captcha\n"); result = decode_slashdot(img); } else diff --git a/src/phpbb.c b/src/phpbb.c index 6f9bca3..a4c8043 100644 --- a/src/phpbb.c +++ b/src/phpbb.c @@ -37,6 +37,7 @@ char *decode_phpbb(struct image *img) /* phpBB captchas have 6 characters */ result = malloc(7 * sizeof(char)); + strcpy(result, " "); if(!font) { @@ -58,8 +59,6 @@ char *decode_phpbb(struct image *img) setpixel(tmp3, x, y, 255, g, 255); } - strcpy(result, " "); - for(cur = 0; cur < 6; cur++) { /* Try to find 1st letter */ diff --git a/src/slashdot.c b/src/slashdot.c index a377139..1129033 100644 --- a/src/slashdot.c +++ b/src/slashdot.c @@ -45,6 +45,7 @@ char *decode_slashdot(struct image *img) /* Slashdot captchas have 7 characters */ result = malloc(8 * sizeof(char)); + strcpy(result, " "); /* Clean image a bit */ tmp1 = filter_detect_lines(img); @@ -256,8 +257,6 @@ static struct image *find_glyphs(struct image *img) setpixel(dst, x, y, 255, g, 255); } - strcpy(result, " "); - for(x = 0; x < font->width; x++) { int found = 0;