(quote_string): don't sign extend the (signed) char to avoid printing

too much, add an assert to check that we didn't overrun the buffer.


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@20891 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2007-06-04 22:51:41 +00:00
parent fcc3edd1aa
commit 0f76edd889

View File

@@ -82,11 +82,12 @@ quote_string(const char *f, size_t len, size_t *rlen)
to[j++] = from[i];
} else {
int l = snprintf(&to[j], tolen - j - 1,
"#%02x", (unsigned int)from[i]);
"#%02x", (unsigned char)from[i]);
j += l;
}
}
to[j] = '\0';
assert(j < tolen);
*rlen = j;
return to;
}