forked from sosy-lab/sv-benchmarks
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request sosy-lab#428 from tautschnig/busybox-fixes4
BusyBox fixes to address sosy-lab#424
- Loading branch information
Showing
40 changed files
with
477 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
char *dirname(char *path) | ||
{ | ||
static char dir[42]; // I believe PATH_MAX would be the correct length | ||
for(int i=0; i<42; ++i) | ||
dir[i] = __VERIFIER_nondet_char(); | ||
dir[41] = '\0'; | ||
return dir; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#define getgrgid bb_internal_getgrgid | ||
|
||
struct group *getgrgid(gid_t gid) | ||
{ | ||
(void)gid; | ||
|
||
static struct group g; | ||
|
||
g.gr_name = ""; /* group name */ | ||
g.gr_passwd = ""; /* group password */ | ||
g.gr_gid = __VERIFIER_nondet_uint(); | ||
g.gr_mem = NULL; /* group members */ | ||
|
||
return &g; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#define getpwnam bb_internal_getpwnam | ||
|
||
struct passwd *getpwnam(const char *name) | ||
{ | ||
(void)name; | ||
|
||
static struct passwd p; | ||
|
||
p.pw_name = ""; /* username */ | ||
p.pw_passwd = ""; /* user password */ | ||
p.pw_uid = __VERIFIER_nondet_uint(); | ||
p.pw_gid = __VERIFIER_nondet_uint(); | ||
p.pw_gecos = ""; /* real name */ | ||
p.pw_dir = ""; /* home directory */ | ||
p.pw_shell = ""; /* shell program */ | ||
|
||
return &p; | ||
} | ||
|
||
#define getpwuid bb_internal_getpwuid | ||
|
||
struct passwd *getpwuid(uid_t uid) | ||
{ | ||
(void)uid; | ||
|
||
return getpwnam(0); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset) | ||
{ | ||
if(__VERIFIER_nondet_int()) | ||
return MAP_FAILED; | ||
|
||
(void)addr; | ||
(void)prot; | ||
(void)offset; | ||
|
||
if(flags & MAP_ANONYMOUS) | ||
{ | ||
if(fd != -1) | ||
__VERIFIER_error(); | ||
|
||
void *res=calloc(length, 1); | ||
if(res == NULL) | ||
return MAP_FAILED; | ||
|
||
return res; | ||
} | ||
else | ||
return malloc(length); | ||
} | ||
|
||
int munmap(void *addr, size_t length) | ||
{ | ||
if(__VERIFIER_nondet_int()) | ||
return -1; | ||
|
||
(void)length; | ||
|
||
free(addr); | ||
|
||
return 0; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
ssize_t readlink(const char *path, char *buf, size_t bufsiz) | ||
{ | ||
(void)*path; | ||
|
||
if(__VERIFIER_nondet_int() || bufsiz < 1) | ||
return -1; | ||
|
||
unsigned long len = __VERIFIER_nondet_ulong(); | ||
__VERIFIER_assume(len <= bufsiz); | ||
|
||
for(size_t i=0; i<len; ++i) | ||
buf[i] = __VERIFIER_nondet_char(); | ||
|
||
return len; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
char *realpath(const char *path, char *resolved_path) | ||
{ | ||
if(__VERIFIER_nondet_int()) | ||
return NULL; | ||
|
||
unsigned long offset=__VERIFIER_nondet_ulong(); | ||
__VERIFIER_assume(offset<PATH_MAX); | ||
|
||
if(resolved_path == NULL) | ||
resolved_path = malloc(offset+1); | ||
|
||
/* terminating zero */ | ||
*(resolved_path + offset) = '\0'; | ||
|
||
return resolved_path; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
char *stpcpy(char *dest, const char *src) | ||
{ | ||
while(*dest++ = *src++); | ||
return dest; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
int ttyname_r(int fd, char *buf, size_t buflen) | ||
{ | ||
if(__VERIFIER_nondet_int() || buflen < 1) | ||
return -1; // should be proper error numbers | ||
|
||
for(size_t i=0; i<buflen-1; ++i) | ||
buf[i] = __VERIFIER_nondet_char(); | ||
buf[buflen-1] = '\0'; | ||
|
||
return 0; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.