|
From: | Riccardo Mottola |
Subject: | Re: PC segmentation fault |
Date: | Sat, 21 Sep 2013 20:01:03 +0200 |
User-agent: | Mozilla/5.0 (Windows NT 5.1; rv:23.0) Gecko/20100101 Firefox/23.0 SeaMonkey/2.20 |
Hi, Wolfgang Lux wrote:
Yes, that it perfect and it works. I was looking for about the same fix, but with a double nested if. However since endType isn't used in the code below, you solution is just more compact!Okay, upon a second inspection the original termination condition i < _length + 1 may be right, but in that case the assignment endType = codeType(_uchar+end) is wrong. In fact, you do not need this assignment and the local variable endType at all. Instead the condition in the if statement should be corrected. Change if ((startType != endType) || (end == _length)) into if (end == _length || startType != codeType(_uchar+end)) so that the array access is made only within the bounds of the buffer.
Riccardo
[Prev in Thread] | Current Thread | [Next in Thread] |