libc: rewrite putenv and getenv.

These new implementations

- do several validity check on input parameters
- allow a bit larger variable names (127 bytes, aka sizeof(Proc.genbuf)-1)
- preserve nulls in the content (the original version used to replace
  '\0' with ' '). I can't see why they did, actually.
  See also http://marc.info/?l=9fans&m=148475801229908&w=2

Should also fix CID 155718
This commit is contained in:
2017-01-19 00:58:43 +01:00
parent d43be3861b
commit 65cdad4317
6 changed files with 118 additions and 58 deletions

View File

@ -46,7 +46,7 @@ extern int strncmp(const char*, const char*, int32_t);
extern char* strpbrk(const char*, const char*);
extern char* strrchr(const char*, int);
extern char* strtok(char*, char*);
extern int32_t strlen(const char*);
extern int strlen(const char*);
extern int32_t strspn(const char*, const char*);
extern int32_t strcspn(const char*, const char*);
extern char* strstr(const char*, const char*);