tests: fix invalid pointer checks in quotactl test

* tests/quotactl.h (bogus_special, bogus_addr): Move it...
* tests/quotactl.c (main): ... here; remove static and const qualifiers,
use memory after tail_alloc instead of magic numbers.
* tests/quotactl-xfs.c (main): Likewise.
This commit is contained in:
Eugene Syromyatnikov
2016-10-30 22:28:37 +03:00
parent 3fb04c6aec
commit 5ca0852f5f
3 changed files with 6 additions and 4 deletions

View File

@ -199,6 +199,9 @@ print_xquota_statv(int rc, void *ptr, void *arg)
int
main(void)
{
char *bogus_special = (char *) tail_alloc(1) + 1;
void *bogus_addr = (char *) tail_alloc(1) + 1;
char bogus_special_str[sizeof(void *) * 2 + sizeof("0x")];
char bogus_addr_str[sizeof(void *) * 2 + sizeof("0x")];
char unterminated_str[sizeof(void *) * 2 + sizeof("0x")];

View File

@ -164,6 +164,9 @@ print_dqinfo(long rc, void *ptr, void *arg)
int
main(void)
{
char *bogus_special = (char *) tail_alloc(1) + 1;
void *bogus_addr = (char *) tail_alloc(1) + 1;
char bogus_special_str[sizeof(void *) * 2 + sizeof("0x")];
char unterminated_str[sizeof(void *) * 2 + sizeof("0x")];

View File

@ -155,11 +155,7 @@ check_quota(uint32_t flags, int cmd, const char *cmd_str,
static const int bogus_cmd = 0xbadc0ded;
static const char * const bogus_special =
(const char *) (unsigned long) 0xfffffca7ffffc0deULL;
static const int bogus_id = 0xca7faced;
static void * const bogus_addr =
(void *) (unsigned long) 0xffffda7affffdeadULL;
/* It is invalid anyway due to the flash in the end */
static const char *bogus_dev = "/dev/bogus/";