archlinuxfr / package-query

Query alpm database and AUR
69 stars 17 forks source link

Segfault when format_out leads to empty out #107

Closed nheir closed 8 years ago

nheir commented 8 years ago

Step to reproduce: package-query -Qs firefox -f "%t" or package-query -Qs firefox -f ""

That issue is rare but it's a segfault after all.

It comes from util.c, string_t.s is NULL as long as there is nothing to add (including empty string). Then pkg_to_str return NULL instead of empty string and print_package doesn't handle it.

f2404 commented 8 years ago

@nheir Thanks for the report! I'll get it handled.

f2404 commented 8 years ago

Fixed via https://github.com/archlinuxfr/package-query/commit/2f38ab09e859045287a3f136792cfcbe096f5eaf