Package: apt-spy
Severity: important

int build_country_file(FILE *config_p, FILE *infile_p, FILE
                *mirror_list, char *country_list)
{
        char *country_code;
//            ^^^^^^^^^^^^
        char *p, *q; 
        char *inputline;

        int found = 0;

        /* Upper-case country list */
        str_toupper(country_list);

        /* A cheap way to make sure we have enough space */
        country_code = malloc(strlen(country_code));
//      ^^^^^^^^^^^^                 ^^^^^^^^^^^^

        ...

I take it this is unintentional?  Probably the argument to strlen()
should be country_list.  Valgrind will confirm an invalid memory
access.

However, I don't really understand why country_code needs to be
dynamically allocated; it seems like char country_code[4]; should be
sufficient (after adding code to limit the number of characters copied
to that buffer).

Justin


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to