Ah, right. %d will produce signed output for the signed char values in
h_addr_list:

int main(int argc, char * argv[])
{
    char h_addr_list[4] = { 124, 198, 140, 142 };

    printf("%d.%d.%d.%d\n",
        h_addr_list[0], h_addr_list[1],
        h_addr_list[2], h_addr_list[3]);

    printf("%d.%d.%d.%d\n",
        (unsigned char)h_addr_list[0], (unsigned char)h_addr_list[1],
        (unsigned char)h_addr_list[2], (unsigned char)h_addr_list[3]);

    return 0;
}

$ ./test
124.-58.-116.-114
124.198.140.142

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/722386

Title:
  PAM pgsql buffer overflow when dealing with long addresses

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to