[augeas-devel] augeas: master - * src/internal.c (escape): convert char to unsigned when printing as octal

David Lutterkort lutter at fedoraproject.org
Tue Oct 20 13:20:18 UTC 2009


Gitweb:        http://git.fedorahosted.org/git/augeas.git?p=augeas.git;a=commitdiff;h=5c18068e858be71be8ab7083df61ece722da4772
Commit:        5c18068e858be71be8ab7083df61ece722da4772
Parent:        4b92965fc2529e462d8ce6f8ff88caa019a89345
Author:        David Lutterkort <lutter at redhat.com>
AuthorDate:    Tue Oct 20 14:38:05 2009 +0200
Committer:     David Lutterkort <lutter at redhat.com>
CommitterDate: Tue Oct 20 14:38:05 2009 +0200

* src/internal.c (escape): convert char to unsigned when printing as octal

Without that, there's no guarantee that the char will be printed as three
octal digits and not more
---
 src/internal.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/internal.c b/src/internal.c
index 4df027f..3ac5350 100644
--- a/src/internal.c
+++ b/src/internal.c
@@ -203,7 +203,7 @@ char *escape(const char *text, int cnt) {
             *e++ = '\\';
             *e++ = escape_names[p - escape_chars];
         } else if (! isprint(text[i])) {
-            sprintf(e, "\\%03o", text[i]);
+            sprintf(e, "\\%03o", (unsigned char) text[i]);
             e += 4;
         } else {
             *e++ = text[i];




More information about the augeas-devel mailing list