Avoid possible buffer overflow.

sprintf can cause buffer overflow problem as it does not check length of src. snprintf takes only given no of bytes and hence avoids buffer overflow problem.