mirror of https://github.com/OpenVPN/openvpn-gui
				
				
				
			fix ManagementCommandFromInput()
							parent
							
								
									3c81b7a4f2
								
							
						
					
					
						commit
						577d22dbc3
					
				
							
								
								
									
										7
									
								
								misc.c
								
								
								
								
							
							
						
						
									
										7
									
								
								misc.c
								
								
								
								
							| 
						 | 
					@ -47,7 +47,7 @@ GetDlgItemTextUtf8(HWND hDlg, int id, LPSTR *str, int *len)
 | 
				
			||||||
    *len = 0;
 | 
					    *len = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ucs2_len = GetWindowTextLength(GetDlgItem(hDlg, id)) + 1;
 | 
					    ucs2_len = GetWindowTextLength(GetDlgItem(hDlg, id)) + 1;
 | 
				
			||||||
    if (ucs2_len == 0)
 | 
					    if (ucs2_len == 1)
 | 
				
			||||||
        goto out;
 | 
					        goto out;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ucs2_str = malloc(ucs2_len * sizeof(*ucs2_str));
 | 
					    ucs2_str = malloc(ucs2_len * sizeof(*ucs2_str));
 | 
				
			||||||
| 
						 | 
					@ -77,7 +77,7 @@ out:
 | 
				
			||||||
 * Generate a management command from user input and send it
 | 
					 * Generate a management command from user input and send it
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
BOOL
 | 
					BOOL
 | 
				
			||||||
ManagementCommandFromInput(connection_t *c, LPSTR fmt, HWND hDlg, int id)
 | 
					ManagementCommandFromInput(connection_t *c, LPCSTR fmt, HWND hDlg, int id)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    BOOL retval = FALSE;
 | 
					    BOOL retval = FALSE;
 | 
				
			||||||
    LPSTR input, cmd;
 | 
					    LPSTR input, cmd;
 | 
				
			||||||
| 
						 | 
					@ -95,9 +95,12 @@ ManagementCommandFromInput(connection_t *c, LPSTR fmt, HWND hDlg, int id)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Clear buffers with potentially secret content */
 | 
					    /* Clear buffers with potentially secret content */
 | 
				
			||||||
 | 
					    if (input_len)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
        memset(input, 'x', input_len - 1);
 | 
					        memset(input, 'x', input_len - 1);
 | 
				
			||||||
        SetDlgItemTextA(hDlg, id, input);
 | 
					        SetDlgItemTextA(hDlg, id, input);
 | 
				
			||||||
        free(input);
 | 
					        free(input);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return retval;
 | 
					    return retval;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										2
									
								
								misc.h
								
								
								
								
							
							
						
						
									
										2
									
								
								misc.h
								
								
								
								
							| 
						 | 
					@ -22,7 +22,7 @@
 | 
				
			||||||
#ifndef MISC_H
 | 
					#ifndef MISC_H
 | 
				
			||||||
#define MISC_H
 | 
					#define MISC_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
BOOL ManagementCommandFromInput(connection_t *, LPSTR, HWND, int);
 | 
					BOOL ManagementCommandFromInput(connection_t *, LPCSTR, HWND, int);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
BOOL streq(LPCSTR, LPCSTR);
 | 
					BOOL streq(LPCSTR, LPCSTR);
 | 
				
			||||||
BOOL wcsbegins(LPCWSTR, LPCWSTR);
 | 
					BOOL wcsbegins(LPCWSTR, LPCWSTR);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue