I just want to say too, that even though you may get bored seeing me asking for a hand.
Actually I wish there were more people asking for help here.
i thought there might be a simplish fix, as it's only the last few pixels
It's indeed simple to fix "the last few pixels".
There's no problem on the the left border because you're always starting with the left-most pixel in the texture.
So you just have to make sure that the last pixel of a scanline adresses the right-most pixel in the texture:
pos_xx=( pos_x*(texture->wwidth-1)\(length-1))