Use dynamic allocated memory for skey and svalue,
allocate the length of value so that there are no limits,
but don't use the %a gnu extension to maintain compatibility
CONF("alias") {
if (value) {
- char skey[1024], svalue[1024];
+ size_t maxlength = strlen(value); //+1 for terminating 0 not needed, 'cause of the space in the middle of value
+ char *skey = malloc(maxlength);
+ char *svalue = malloc(maxlength);
char *oldvalue;
- if (sscanf(value, "%1023[0-9a-zA-Z_] %1023[^\n]", skey, svalue) == 2) {
+ if (sscanf(value, "%[0-9a-zA-Z_] %[^\n]", skey, svalue) == 2) {
oldvalue = getenv(skey);
if (oldvalue == NULL) {
setenv(skey, svalue, 0);
} else {
CONF_ERR;
}
+ free(skey);
+ free(svalue);
} else {
CONF_ERR;
}