diff options
Diffstat (limited to 'modutils/modinfo.c')
-rw-r--r-- | modutils/modinfo.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/modutils/modinfo.c b/modutils/modinfo.c index ee379304c..8e74b6438 100644 --- a/modutils/modinfo.c +++ b/modutils/modinfo.c | |||
@@ -62,7 +62,7 @@ static void modinfo(const char *path, const char *version, | |||
62 | "firmware", | 62 | "firmware", |
63 | }; | 63 | }; |
64 | size_t len; | 64 | size_t len; |
65 | int j, length; | 65 | int j; |
66 | char *ptr, *the_module; | 66 | char *ptr, *the_module; |
67 | const char *field = env->field; | 67 | const char *field = env->field; |
68 | int tags = env->tags; | 68 | int tags = env->tags; |
@@ -94,16 +94,18 @@ static void modinfo(const char *path, const char *version, | |||
94 | pattern = field; | 94 | pattern = field; |
95 | if ((1<<j) & OPT_TAGS) | 95 | if ((1<<j) & OPT_TAGS) |
96 | pattern = shortcuts[j]; | 96 | pattern = shortcuts[j]; |
97 | length = strlen(pattern); | ||
98 | ptr = the_module; | 97 | ptr = the_module; |
99 | while (1) { | 98 | while (1) { |
99 | char *after_pattern; | ||
100 | |||
100 | ptr = memchr(ptr, *pattern, len - (ptr - (char*)the_module)); | 101 | ptr = memchr(ptr, *pattern, len - (ptr - (char*)the_module)); |
101 | if (ptr == NULL) /* no occurance left, done */ | 102 | if (ptr == NULL) /* no occurance left, done */ |
102 | break; | 103 | break; |
103 | if (strncmp(ptr, pattern, length) == 0 && ptr[length] == '=') { | 104 | after_pattern = is_prefixed_with(ptr, pattern); |
105 | if (after_pattern && *after_pattern == '=') { | ||
104 | /* field prefixes are 0x80 or 0x00 */ | 106 | /* field prefixes are 0x80 or 0x00 */ |
105 | if ((ptr[-1] & 0x7F) == '\0') { | 107 | if ((ptr[-1] & 0x7F) == 0x00) { |
106 | ptr += length + 1; | 108 | ptr = after_pattern + 1; |
107 | display(ptr, pattern, (1<<j) != tags); | 109 | display(ptr, pattern, (1<<j) != tags); |
108 | ptr += strlen(ptr); | 110 | ptr += strlen(ptr); |
109 | } | 111 | } |