diff -upr rarian-0.5.6-pre/librarian/rarian-reg-full.c rarian-0.5.6-post/librarian/rarian-reg-full.c --- rarian-0.5.6-pre/librarian/rarian-reg-full.c 2007-07-31 12:16:06.000000000 -0500 +++ rarian-0.5.6-post/librarian/rarian-reg-full.c 2007-08-30 19:22:37.000000000 -0500 @@ -171,12 +171,12 @@ rrn_reg_parse_file_full (char *filename) sep = strrchr (filename, '/'); last = strrchr (filename, '.'); - if (!last || !sep) { + if (!last || !sep || last < sep) { fprintf (stderr, "Error: Can't cut put basename properly\n"); rrn_reg_free_full (reg); return NULL; } - basename = rrn_strndup (last+1, sep-last+1); + basename = rrn_strndup (sep + 1, last - (sep + 1)); reg->identifier = malloc (sizeof (char)*(strlen(basename)+11)); sprintf (reg->identifier, "org.other.%s", basename); free (basename); diff -upr rarian-0.5.6-pre/librarian/rarian-reg-utils.c rarian-0.5.6-post/librarian/rarian-reg-utils.c --- rarian-0.5.6-pre/librarian/rarian-reg-utils.c 2007-08-30 19:19:41.000000000 -0500 +++ rarian-0.5.6-post/librarian/rarian-reg-utils.c 2007-08-30 19:22:30.000000000 -0500 @@ -187,12 +187,12 @@ rrn_reg_parse_file (char *filename) sep = strrchr (filename, '/'); last = strrchr (filename, '.'); - if (!last || !sep) { + if (!last || !sep || last < sep) { fprintf (stderr, "Error: Can't cut put basename properly\n"); rrn_reg_free (reg); return NULL; } - basename = rrn_strndup (last+1, sep-last+1); + basename = rrn_strndup (sep + 1, last - (sep + 1)); reg->identifier = malloc (sizeof (char)*(strlen(basename)+11)); sprintf (reg->identifier, "org.other.%s", basename); free (basename);