When loading an empty file, libyaml will fire a single scalar
event causing us to create a key that contains an empty string.
We're not interested in this, so skip an empty scalar value
when expecting a key.
Redmine issue:
https://redmine.openinfosecfoundation.org/issues/2418
char *tag = (char *)event.data.scalar.tag;
SCLogDebug("event.type=YAML_SCALAR_EVENT; state=%d; value=%s; "
"tag=%s; inseq=%d", state, value, tag, inseq);
+
+ /* Skip over empty scalar values while in KEY state. This
+ * tends to only happen on an empty file, where a scalar
+ * event probably shouldn't fire anyways. */
+ if (state == CONF_KEY && strlen(value) == 0) {
+ goto next;
+ }
+
if (inseq) {
char sequence_node_name[DEFAULT_NAME_LEN];
snprintf(sequence_node_name, DEFAULT_NAME_LEN, "%d", seq_idx++);