Code:
$cat missedfield
aaa,bbb,ccc
aaa,bbb,ccc,ddd
111,222,333,444
111,222,333,444
111,222,333,444,555
$nawk -F, '{if(NF<5 && $NF > 2){$2="XXX" OFS $2;print;next}} 1' OFS=, missedfield
aaa,XXX,bbb,ccc
aaa,XXX,bbb,ccc,ddd
111,XXX,222,333,444
111,XXX,222,333,444
111,222,333,444,555
$nawk 'NF<5{$1=$1 FS "XXX"}1' FS=, OFS=, missedfield
aaa,XXX,bbb,ccc
aaa,XXX,bbb,ccc,ddd
111,XXX,222,333,444
111,XXX,222,333,444
111,222,333,444,555