summaryrefslogtreecommitdiffstats
path: root/ipecamera/reader.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@dside.dyndns.org>2012-10-22 21:08:46 +0200
committerSuren A. Chilingaryan <csa@dside.dyndns.org>2012-10-22 21:08:46 +0200
commit90895b21b4b87f1f8f5ff8854c0de376f7688146 (patch)
tree059c566e2eb4e144f1ab3c76b26feb9614573997 /ipecamera/reader.c
parent761270f64b565f433233455e093a6a0b0ab6c747 (diff)
downloadipecamera-90895b21b4b87f1f8f5ff8854c0de376f7688146.tar.gz
ipecamera-90895b21b4b87f1f8f5ff8854c0de376f7688146.tar.bz2
ipecamera-90895b21b4b87f1f8f5ff8854c0de376f7688146.tar.xz
ipecamera-90895b21b4b87f1f8f5ff8854c0de376f7688146.zip
Skip non-informative packets on DMA
Diffstat (limited to 'ipecamera/reader.c')
-rw-r--r--ipecamera/reader.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/ipecamera/reader.c b/ipecamera/reader.c
index 048f536..5fb5840 100644
--- a/ipecamera/reader.c
+++ b/ipecamera/reader.c
@@ -98,7 +98,11 @@ static int ipecamera_data_callback(void *user, pcilib_dma_flags_t flags, size_t
size_t startpos;
for (startpos = 0; (startpos + 8) < bufsize; startpos++) {
if (!memcmp(buf + startpos, frame_magic, sizeof(frame_magic))) break;
-//o raw_size =
+ }
+
+ if ((startpos + 8) >= bufsize) {
+ pcilib_warning("Invalid DMA packet received");
+ return PCILIB_STREAMING_REQ_FRAGMENT;
}
if (startpos) {