Removing var assingment from loop and calculating buffer length outside the loop
Merge pull request #1 from Theodeus/master

Removing var assingment from loop and calculating buffer length outside ...