[emt] r225 committed - This changes how the sub name matching works. Instead of verifying tha...

5 views
Skip to first unread message

e...@googlecode.com

unread,
Jan 12, 2012, 6:38:25 PM1/12/12
to emt...@googlegroups.com
Revision: 225
Author: eric.bergen
Date: Thu Jan 12 15:37:38 2012
Log: This changes how the sub name matching works. Instead of
verifying that the subname has an alpha numeric character it now verifies
that the sub name doesn't use any delimiters. It's still possible to send
trash through but at least it won't mess up the local text handler. There
are also a few more changes of split calls to preg_split. Contributed by
Kyle Wayman - kwa...@gmail.com. Thanks Kyle!

http://code.google.com/p/emt/source/detail?r=225

Modified:
/trunk/base/field.php
/trunk/base/io_base.php
/trunk/bin/emt_gather
/trunk/plugins/commands/proc_net.php

=======================================
--- /trunk/base/field.php Thu Jan 12 15:31:08 2012
+++ /trunk/base/field.php Thu Jan 12 15:37:38 2012
@@ -138,11 +138,11 @@

foreach ($fields as $field)
{
- list($key, $value) = preg_split('/=/', $field);
+ list($key, $value) = preg_split('/=/', $field, 2);

if (strstr($key, '.'))
{
- list($name, $sub_name) = preg_split('/\./', $key);
+ list($name, $sub_name) = preg_split('/\./', $key, 2);

if ($name == $this->name)
{
=======================================
--- /trunk/base/io_base.php Thu Jan 12 15:31:08 2012
+++ /trunk/base/io_base.php Thu Jan 12 15:37:38 2012
@@ -88,14 +88,14 @@
if (!strlen($kv))
continue;

- list ($key, $value) = preg_split('/=/', $kv);
+ list ($key, $value) = preg_split('/=/', $kv, 2);

//remove the instance from the key name
$instance = '';

if (strstr($key, ':'))
{
- list ($instance, $key) = preg_split('/:/', $key);
+ list ($instance, $key) = preg_split('/:/', $key, 2);
}

//separate the field name from the sub field name
=======================================
--- /trunk/bin/emt_gather Wed Apr 13 12:35:43 2011
+++ /trunk/bin/emt_gather Thu Jan 12 15:37:38 2012
@@ -219,7 +219,7 @@

foreach ($f->values as $key => $value)
{
- if (!preg_match('/[a-zA-Z0-9]/', $key))
+ if (preg_match('/[ .,:]/', $key))
{
log_error("Field {$f->name} tried to write an
invalid sub_name of ($key) with value ($value). sub_name ($key) will be
dropped");
unset($f->values[$key]);
=======================================
--- /trunk/plugins/commands/proc_net.php Thu Jan 12 15:31:08 2012
+++ /trunk/plugins/commands/proc_net.php Thu Jan 12 15:37:38 2012
@@ -38,11 +38,11 @@
if (!strstr($field, '='))
continue;

- list($key, $value) = preg_split('/=/', $field);
+ list($key, $value) = preg_split('/=/', $field, 2);

if (strstr($key, '.'))
{
- list($name, $sub_name) = preg_split('/\./', $key);
+ list($name, $sub_name) = preg_split('/\./', $key, 2);

if ($name == $this->name)
{

Reply all
Reply to author
Forward
0 new messages