Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.0:Ports
atftp
atftpd-0.7_unprotected_assignments_crash.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File atftpd-0.7_unprotected_assignments_crash.patch of Package atftp
Index: tftpd_list.c =================================================================== --- tftpd_list.c.orig +++ tftpd_list.c @@ -49,11 +49,11 @@ pthread_mutex_t thread_list_mutex = PTHR */ int tftpd_list_add(struct thread_data *new) { - struct thread_data *current = thread_data; + struct thread_data *current; int ret; pthread_mutex_lock(&thread_list_mutex); - + current = thread_data; number_of_thread++; ret = number_of_thread; @@ -81,11 +81,13 @@ int tftpd_list_add(struct thread_data *n */ int tftpd_list_remove(struct thread_data *old) { - struct thread_data *current = thread_data; + struct thread_data *current; int ret; pthread_mutex_lock(&thread_list_mutex); + current = thread_data; + number_of_thread--; ret = number_of_thread; @@ -137,23 +139,26 @@ int tftpd_list_find_multicast_server_and struct thread_data *data, struct client_info *client) { - struct thread_data *current = thread_data; /* head of the list */ - struct tftp_opt *tftp_options = data->tftp_options; + struct thread_data *current; /* head of the list */ + struct tftp_opt *tftp_options; struct client_info *tmp; char options[MAXLEN]; char string[MAXLEN]; char *index; size_t len; + /* lock the whole list before walking it */ + pthread_mutex_lock(&thread_list_mutex); + *thread = NULL; + current = thread_data; + tftp_options = data->tftp_options; + opt_request_to_string(tftp_options, options, MAXLEN); index = strstr(options, "multicast"); len = (size_t)(index - options); - /* lock the whole list before walking it */ - pthread_mutex_lock(&thread_list_mutex); - while (current) { if (current != data) @@ -215,9 +220,10 @@ inline void tftpd_clientlist_ready(struc void tftpd_clientlist_remove(struct thread_data *thread, struct client_info *client) { - struct client_info *tmp = thread->client_info; + struct client_info *tmp; pthread_mutex_lock(&thread->client_mutex); + tmp = thread->client_info; while ((tmp->next != client) && (tmp->next != NULL)) tmp = tmp->next; if (tmp->next == NULL) @@ -232,9 +238,11 @@ void tftpd_clientlist_remove(struct thre void tftpd_clientlist_free(struct thread_data *thread) { struct client_info *tmp; - struct client_info *head = thread->client_info; + struct client_info *head; pthread_mutex_lock(&thread->client_mutex); + head = thread->client_info; + while (head) { tmp = head; @@ -251,9 +259,10 @@ int tftpd_clientlist_done(struct thread_ struct client_info *client, struct sockaddr_in *sock) { - struct client_info *head = thread->client_info; + struct client_info *head; pthread_mutex_lock(&thread->client_mutex); + head = thread->client_info; if (client) { @@ -335,10 +344,10 @@ int tftpd_clientlist_next(struct thread_ void tftpd_list_kill_threads(void) { - struct thread_data *current = thread_data; /* head of list */ + struct thread_data *current; /* head of list */ pthread_mutex_lock(&thread_list_mutex); - + current = thread_data; while (current != NULL) { Index: tftpd_mcast.c =================================================================== --- tftpd_mcast.c.orig +++ tftpd_mcast.c @@ -51,9 +51,11 @@ struct tid *tid_list = NULL; */ int tftpd_mcast_get_tid(char **addr, short *port) { - struct tid *current = tid_list; + struct tid *current; pthread_mutex_lock(&mcast_tid_list); + current = tid_list; + /* walk the list for a free tid */ while (current != NULL) { @@ -74,9 +76,11 @@ int tftpd_mcast_get_tid(char **addr, sho int tftpd_mcast_free_tid(char *addr, short port) { - struct tid *current = tid_list; + struct tid *current; pthread_mutex_lock(&mcast_tid_list); + current = tid_list; + while (current != NULL) { if ((current->used == 1) && (current->port == port) &&
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor