#include "flow-var.h"
+#include "util-byte.h"
#include "util-debug.h"
static int DetectOffsetSetup(DetectEngineCtx *, Signature *, const char *);
cd->offset = ((DetectByteExtractData *)bed_sm->ctx)->local_id;
cd->flags |= DETECT_CONTENT_OFFSET_BE;
} else {
- cd->offset = (uint32_t)atoi(str);
+ if (ByteExtractStringUint16(&cd->offset, 0, 0, str) != (int)strlen(str))
+ {
+ SCLogError(SC_ERR_INVALID_SIGNATURE, "invalid value for offset: %s", str);
+ goto end;
+ }
if (cd->depth != 0) {
if (cd->depth < cd->content_len) {
SCLogDebug("depth increased to %"PRIu32" to match pattern len",