aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2014-03-17 20:17:05 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2014-03-17 20:17:05 +0100
commit0316e66b92f7519648ea3f17fe8530fc27f5b84f (patch)
treed30e7396d6b5fc2212e3ebe3e74a96cf5ca9db1b
parent494cfc58d115031a08bebd6e26e5e983bc44811a (diff)
downloaddabmux-0316e66b92f7519648ea3f17fe8530fc27f5b84f.tar.gz
dabmux-0316e66b92f7519648ea3f17fe8530fc27f5b84f.tar.bz2
dabmux-0316e66b92f7519648ea3f17fe8530fc27f5b84f.zip
add assert for figSize to protect memcpy
-rw-r--r--src/DabMux.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/DabMux.cpp b/src/DabMux.cpp
index 7b6530d..fd008a1 100644
--- a/src/DabMux.cpp
+++ b/src/DabMux.cpp
@@ -1626,6 +1626,7 @@ int main(int argc, char *argv[])
break;
}
+ assert(figSize <= 30);
memcpy(&etiFrame[index], Padding_FIB, 30 - figSize);
index += 30 - figSize;
@@ -1731,6 +1732,10 @@ int main(int argc, char *argv[])
etiFrame[index++] = ((char *) &CRCtmp)[1];
etiFrame[index++] = ((char *) &CRCtmp)[0];
+ /* ETSI EN 300 799 Table 2:
+ * Only TM3 has a FIB count to CIF count that is
+ * not 3 to 1.
+ */
if (ensemble->mode == 3) {
memcpy(&etiFrame[index], Padding_FIB, 30);
index += 30;