s += GET_U_1(s) + 1;
ND_TCHECK_1(s);
}
- return(ND_BYTES_BETWEEN(s, s0) + 1);
+ return(ND_BYTES_BETWEEN(s0, s) + 1);
trunc:
return(-1); /* name goes past the end of the buffer */
u_int i = 0;
while ((p = strchr(fmt, '|'))) {
- u_int l = ND_BYTES_BETWEEN(p, fmt);
+ u_int l = ND_BYTES_BETWEEN(fmt, p);
if (l && (val & (1 << i)))
ND_PRINT("%.*s ", (int)l, fmt);
fmt = p + 1;
}
}
if (!use_unicode) {
- while (strsize != 0) {
+ while (strsize != 0) {
c = GET_U_1(s);
s++;
strsize--;
u_int l;
p = strchr(++fmt, '}');
- l = ND_BYTES_BETWEEN(p, fmt);
+ l = ND_BYTES_BETWEEN(fmt, p);
if (l > sizeof(bitfmt) - 1)
l = sizeof(bitfmt)-1;
switch (t) {
case 1:
- name_type = name_extract(ndo, startbuf, ND_BYTES_BETWEEN(buf, startbuf),
- maxbuf, nbuf);
+ name_type = name_extract(ndo, startbuf,
+ ND_BYTES_BETWEEN(startbuf, buf),
+ maxbuf, nbuf);
if (name_type < 0)
goto trunc;
len = name_len(ndo, buf, maxbuf);
}
}
if (!depth && buf < maxbuf) {
- u_int len = ND_BYTES_BETWEEN(maxbuf, buf);
+ u_int len = ND_BYTES_BETWEEN(buf, maxbuf);
ND_PRINT("Data: (%u bytes)\n", len);
smb_data_print(ndo, buf, len);
return(buf + len);