Rev 3056 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3056 | Rev 3225 | ||
---|---|---|---|
Line 279... | Line 279... | ||
279 | ret.val = ((sysinfo_val_fn_t) (item->val.fn)) (item); |
279 | ret.val = ((sysinfo_val_fn_t) (item->val.fn)) (item); |
280 | } |
280 | } |
281 | return ret; |
281 | return ret; |
282 | } |
282 | } |
283 | 283 | ||
- | 284 | #define SYSINFO_MAX_LEN 1024 |
|
- | 285 | ||
284 | unative_t sys_sysinfo_valid(unative_t ptr, unative_t len) |
286 | unative_t sys_sysinfo_valid(unative_t ptr, unative_t len) |
285 | { |
287 | { |
286 | char *str; |
288 | char *str; |
287 | sysinfo_rettype_t ret = {0, 0}; |
289 | sysinfo_rettype_t ret = {0, 0}; |
- | 290 | ||
- | 291 | if (len > SYSINFO_MAX_LEN) |
|
- | 292 | return ret.valid; |
|
288 | str = malloc(len + 1, 0); |
293 | str = malloc(len + 1, 0); |
289 | 294 | ||
290 | ASSERT(str); |
295 | ASSERT(str); |
291 | if (!((copy_from_uspace(str, (void *) ptr, len + 1)) || (str[len]))) |
296 | if (!((copy_from_uspace(str, (void *) ptr, len + 1)) || (str[len]))) |
292 | ret = sysinfo_get_val(str, NULL); |
297 | ret = sysinfo_get_val(str, NULL); |
Line 297... | Line 302... | ||
297 | 302 | ||
298 | unative_t sys_sysinfo_value(unative_t ptr, unative_t len) |
303 | unative_t sys_sysinfo_value(unative_t ptr, unative_t len) |
299 | { |
304 | { |
300 | char *str; |
305 | char *str; |
301 | sysinfo_rettype_t ret = {0, 0}; |
306 | sysinfo_rettype_t ret = {0, 0}; |
- | 307 | ||
- | 308 | if (len > SYSINFO_MAX_LEN) |
|
- | 309 | return ret.val; |
|
302 | str = malloc(len + 1, 0); |
310 | str = malloc(len + 1, 0); |
303 | 311 | ||
304 | ASSERT(str); |
312 | ASSERT(str); |
305 | if (!((copy_from_uspace(str, (void *) ptr, len + 1)) || (str[len]))) |
313 | if (!((copy_from_uspace(str, (void *) ptr, len + 1)) || (str[len]))) |
306 | ret = sysinfo_get_val(str, NULL); |
314 | ret = sysinfo_get_val(str, NULL); |