exec: use proper header field iterator to print env variables

- issue introduced with the patch for shellshock
- reported by and credits for troubleshooting to Kristian Kielhofner