From: <cv...@li...> - 2003-04-16 15:28:59
|
Changes in directory wzdftpd/backends/plaintext: libplaintext_main.c updated: 1.15 -> 1.16 --- Log message: When committing, check that source and destination structs are not the same (strcpy will likely not work on identical or overlapping memory zones) --- Diffs of the changes: Index: wzdftpd/backends/plaintext/libplaintext_main.c diff -u wzdftpd/backends/plaintext/libplaintext_main.c:1.15 wzdftpd/backends/plaintext/libplaintext_main.c:1.16 --- wzdftpd/backends/plaintext/libplaintext_main.c:1.15 Wed Apr 9 14:05:49 2003 +++ wzdftpd/backends/plaintext/libplaintext_main.c Wed Apr 16 17:28:46 2003 @@ -1088,6 +1088,10 @@ memset(&user_pool[count],0,sizeof(wzd_user_t)); return 0; } + /* basic verification: trying to commit on self ? then ok */ + if (&user_pool[count] == user) { + return 0; + } if (mod_type & _USER_USERNAME) strcpy(user_pool[count].username,user->username); if (mod_type & _USER_USERPASS) { if (strcasecmp(user->userpass,"%")==0) { @@ -1159,6 +1163,10 @@ * in middle of functions it will cause unstability */ memset(&group_pool[count],0,sizeof(wzd_group_t)); + return 0; + } + /* basic verification: trying to commit on self ? then ok */ + if (&group_pool[count] == group) { return 0; } if (mod_type & _GROUP_GROUPNAME) strcpy(group_pool[count].groupname,group->groupname); |