tvherror(LS_PASS, "NIT entry too long (%i)", ol);
return;
}
- memcpy(out, buf, dlen + 2);
+ memcpy(out + ol, buf, dlen + 2);
ol += dlen + 2;
}
dlen += 2;
}
out[8] &= 0xf0;
out[8] |= ((ol - 10) >> 8) & 0x0f;
- out[9] = ol - 10;
+ out[9] = (ol - 10) & 0xff;
if (sizeof(out) - 32 < ol) {
tvherror(LS_PASS, "NIT entry too long (%i)", ol);
/* mux info length */
lptr = ol;
- out[ol++] = 0xf0;
- out[ol++] = 0x00;
+ ol += 2;
/* mux info */
out[ol++] = pm->pm_dst_tsid >> 8;
out[ol++] = pm->pm_dst_sid >> 8;
out[ol++] = pm->pm_dst_sid;
out[ol++] = 0x11;
- out[lptr] = (ol - lptr - 2) >> 8;
- out[lptr+1] = ol - lptr - 2;
+ /* update section length */
+ out[lptr+0] = 0xf0 | (ol - lptr - 2) >> 8;
+ out[lptr+1] = (ol - lptr - 2) & 0xff;
/* update section length */
out[1] = (out[1] & 0xf0) | ((ol + 4 - 3) >> 8);