replaced a strdupa with a variable length array