Fix substr length calculation

We must substract both $pos and length('CCFLAGS = ') from length($dlib).