While the lengths are correctly chosen, you could as well use snprintf here. Makes possible code analyzers (both human and machine) happier.