Hi Parnesh,<div><br></div><div>Thanks for hunting down the source of that warning. Just out of interest, did the buffer overflow cause the program to crash? I'd be surprised if it caused any issues, given that there is no chance for the overflow to have any associated effects (it just overwrites the adjacent byte in the header, which is not used by MRtrix anyway). In any case, this is probably a remnant of the days when MRtrix only supported Analyse, not NIfTI. The correct fix for this should be to change this line: </div>
<div><br><div><div>338 strncpy ((gchar*) &NH->regular, "r\0", 2);</div><div><br></div><div>to: </div><div><br></div><div><div>338 NH->regular = 'r';</div><div>339 NH->dim_info = 0;</div>
</div><div><br></div><div>At least I'm pretty sure that should work - please let me know if you still have issues with that fix. </div><div><br></div><div>I've already made these changes in the main code branch, so assuming there are no problems with them, they'll be included in the next release.</div>
<div>Cheers!</div><div><br></div><div>Donald.</div><div><br></div><div><br></div><div class="gmail_quote">On 19 July 2011 14:14, <span dir="ltr"><Parnesh.Raniga@csiro.au></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-AU" link="blue" vlink="purple"><div><p class="MsoNormal">Hello Donald,<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">I had a brief look at the archives and could not find any information on this so I am assuming it hasn’t been raised before. There is a buffer overflow occurring with mrtrix programs (e.g tracks2prob) when using nifti and analyse file formats as well as compile time warnings about it under ubuntu 11.04. I have traced this to lines 293 in nifti1.cpp and 338 in analyse.cpp. <u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">These lines should be changed from<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">strncpy ((gchar*) &NH->regular, "r\0", 2);<u></u><u></u></p>
<p class="MsoNormal">to <u></u><u></u></p><p class="MsoNormal">strncpy ((gchar*) &NH->regular, "r\0", 1); or strncpy ((gchar*) &NH->regular, "r", 1);<u></u><u></u></p><p class="MsoNormal">
<u></u> <u></u></p><p class="MsoNormal">Cheers,<u></u><u></u></p><p class="MsoNormal">Parnesh<u></u><u></u></p></div></div><br>_______________________________________________<br>
Mrtrix-discussion mailing list<br>
<a href="mailto:Mrtrix-discussion@www.nitrc.org" target="_blank">Mrtrix-discussion@www.nitrc.org</a><br>
<a href="http://www.nitrc.org/mailman/listinfo/mrtrix-discussion" target="_blank">http://www.nitrc.org/mailman/listinfo/mrtrix-discussion</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Jacques-Donald Tournier (PhD)<br>Brain Research Institute, Melbourne, Australia<br>Tel: +61 (0)3 9035 7033<br>
</div></div>