Acceptable use policy optional addition.#2535
Acceptable use policy optional addition.#2535Nexarian wants to merge 1 commit intoneutrinolabs:develfrom
Conversation
5d4b76a to
6783803
Compare
8ce244d to
868d74f
Compare
bde1721 to
38de36e
Compare
38de36e to
11b17e1
Compare
|
I recognize the changes to the xrdp.ini.in file can't be checked in (probably have to be checked in as an example template and/or with the documentation), but otherwise, this is ready to review. The most important workflow change here is that it will now populate the password box with the password that's sent over the wire from the client, and the user could change it. |
| pch = strtok(NULL, "\n"); | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
Memory problems here I think. You're allocating memory with a single call to strdup(), and then expecting auto_free to fix it for you on list_delete(). However, you'll be calling free on addresses mid-way through the allocated block.
How about (in string_calls.c or list.c) :-
static const char *
append_fragment(const char *start, const char *end, struct list *list)
{
unsigned int len = end - start;
char *copy = malloc(len + 1);
g_memcpy(copy, start, len);
copy[len] = '\0';
list_add_item(list, (tintptr)copy);
return end + 1;
}
struct list *
split_string_by_newline(const char *str)
{
struct list *result = list_create();
result->auto_free = 1;
if (str != NULL)
{
const char *p;
while ((p = g_strchr(str, '\n')) != NULL)
{
str = append_fragment(str, p, result);
}
if (*str != '\0')
{
append_fragment(str, str + g_strlen(str), result);
}
}
return result;
}It's got a slightly different signature admittedly, but all memory is freed on list_delete()
There was a problem hiding this comment.
Also, it behaves differently from strtok() for contibuous delimiters.
There was a problem hiding this comment.
This is what happens when you've spent too much of your career in languages with garbage collectors and then go code in an unmanaged memory language when you're tired. You're right of course!
I think I'll split this part up into smaller PRs as always to make them easier to review.
| file_path); | ||
| return 0; | ||
| } | ||
| char *str = (char *)g_malloc(sizeof(char) * (file_size + 1024), 1); |

WIP, don't review this yet!