#define MAX_UNISTR_SIZE 1000
static const char *
unistr(netdissect_options *ndo,
- const u_char *s, uint32_t *len, int use_unicode)
+ const u_char *s, uint32_t *len, int is_null_terminated, int use_unicode)
{
static char buf[MAX_UNISTR_SIZE+1];
size_t l = 0;
padding++;
}
}
- if (*len == 0) {
+ if (is_null_terminated) {
/*
* Null-terminated string.
*/
uint32_t len;
len = 0;
- s = unistr(ndo, buf, &len, (*fmt == 'R') ? 0 : unicodestr);
+ s = unistr(ndo, buf, &len, 1, (*fmt == 'R') ? 0 : unicodestr);
if (s == NULL)
goto trunc;
ND_PRINT("%s", s);
return maxbuf; /* give up */
}
len = 0;
- s = unistr(ndo, buf + 1, &len, (*fmt == 'Y') ? 0 : unicodestr);
+ s = unistr(ndo, buf + 1, &len, 1, (*fmt == 'Y') ? 0 : unicodestr);
if (s == NULL)
goto trunc;
ND_PRINT("%s", s);
case 'C':
{
const char *s;
- s = unistr(ndo, buf, &stringlen, unicodestr);
+ s = unistr(ndo, buf, &stringlen, 0, unicodestr);
if (s == NULL)
goto trunc;
ND_PRINT("%s", s);