
On 09/12/2013 05:31 PM, John Ferlan wrote: [...]
It's possible that tmp_ip == NULL, so how about this instead:
if (tmp_ip == NULL) { ret = 0; goto out; } strcat(tmp_ip, "]");
You won't be getting too far if realloc() fails anyway, but better than core in a few lines on strdup(tmp_ip); failure.
right ... Boris pointed that out to me today, I was too eager to get over it, and sent V2 before I got his feedback
+ } } else { ret = sscanf(id, "%a[^:]:%as", &tmp_ip, &tmp_port); }
- if (ret != 2) { + /* ret == 2: address and port, ret == 1: address only */ + if (ret < 1) { ret = 0; goto out; }
- if (ip) + if (ip) { *ip = strdup(tmp_ip);
If 'tmp_ip == NULL' then this is problematic
Everything else seems fine - so if you want me to sqaush in the above I will do so and then just push.
That would be really nice ... thanks! -- Mit freundlichen Grüßen/Kind Regards Viktor Mihajlovski IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Martina Köderitz Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294