diff options
author | imp <imp@FreeBSD.org> | 2002-01-06 18:03:55 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2002-01-06 18:03:55 +0000 |
commit | 4e1080d4dc4a8faf7f36b5b69d8854a678bdad8e (patch) | |
tree | f31e6a1af69c4d471d68c15c0a26dfeb6c1ce71b /include/inttypes.h | |
parent | f611e6aa01b8009999d8905b3b4e69717ef5fa0a (diff) | |
download | FreeBSD-src-4e1080d4dc4a8faf7f36b5b69d8854a678bdad8e.zip FreeBSD-src-4e1080d4dc4a8faf7f36b5b69d8854a678bdad8e.tar.gz |
Update length more correctly when parsing a cis info field.
Before, we were using
while (*p++ && --len > 0);
to do this. However, len doesn't get decremented for the NUL byte, so when
we used len later to see if we still have CIS left for some optional fields,
we'd run off the end of an array and dump core.
Instead, replace it with
len -= strlen(p) + 1;
p += strlen(p) + 1;
which is more correct. It is a little bogus to assume that p points to
a valid C string, but only a little. The PC Card SPEC mandates that it
does, and we already depend on that with the use of strdup a few lines
earlier. Since much of the rest of the cis parsing code isn't hyper
retentive about error checking, I'll leave that level of checking for
another time and/or another committer :-).
Diffstat (limited to 'include/inttypes.h')
0 files changed, 0 insertions, 0 deletions