summaryrefslogtreecommitdiff
path: root/treesource.c
diff options
context:
space:
mode:
author David Gibson <david@gibson.dropbear.id.au> 2014-06-18 22:49:43 +1000
committer David Gibson <david@gibson.dropbear.id.au> 2014-06-18 22:49:43 +1000
commitfa928fba7e1ce94aef58798e77a9261192fdbb01 (patch)
treea1af3ab90590ad146507f1f61e5052b247c1a000 /treesource.c
parent76a65b14d1bb10f300f518c11aed231575521c2e (diff)
Fix an off-by-2 error in the source output code
This has been there for ages, but the assertion makes no sense in the context of the test immediately preceding it. This caused an abort() when in -I dts -O dts mode with the right sort of internal labels in a string property value. Add a testcase for this and another candidate edge case (though this one we already get right). Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'treesource.c')
-rw-r--r--treesource.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/treesource.c b/treesource.c
index bf7a626..3a87b9f 100644
--- a/treesource.c
+++ b/treesource.c
@@ -109,7 +109,7 @@ static void write_propval_string(FILE *f, struct data val)
break;
case '\0':
fprintf(f, "\", ");
- while (m && (m->offset < i)) {
+ while (m && (m->offset <= (i + 1))) {
if (m->type == LABEL) {
assert(m->offset == (i+1));
fprintf(f, "%s: ", m->ref);