Mercurial > dropbear
comparison svr-authpubkeyoptions.c @ 1610:96e4c9b2cc00 coverity
merge coverity
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Wed, 21 Mar 2018 00:52:02 +0800 |
parents | e37f98ea4f24 |
children | 6a6a0bac52f4 |
comparison
equal
deleted
inserted
replaced
1580:7f2be495dff6 | 1610:96e4c9b2cc00 |
---|---|
111 if (ses.authstate.pubkey_options) { | 111 if (ses.authstate.pubkey_options) { |
112 if (ses.authstate.pubkey_options->forced_command) { | 112 if (ses.authstate.pubkey_options->forced_command) { |
113 m_free(ses.authstate.pubkey_options->forced_command); | 113 m_free(ses.authstate.pubkey_options->forced_command); |
114 } | 114 } |
115 m_free(ses.authstate.pubkey_options); | 115 m_free(ses.authstate.pubkey_options); |
116 ses.authstate.pubkey_options = NULL; | |
117 } | 116 } |
118 } | 117 } |
119 | 118 |
120 /* helper for svr_add_pubkey_options. returns DROPBEAR_SUCCESS if the option is matched, | 119 /* helper for svr_add_pubkey_options. returns DROPBEAR_SUCCESS if the option is matched, |
121 and increments the options_buf */ | 120 and increments the options_buf */ |
167 goto next_option; | 166 goto next_option; |
168 } | 167 } |
169 if (match_option(options_buf, "command=\"") == DROPBEAR_SUCCESS) { | 168 if (match_option(options_buf, "command=\"") == DROPBEAR_SUCCESS) { |
170 int escaped = 0; | 169 int escaped = 0; |
171 const unsigned char* command_start = buf_getptr(options_buf, 0); | 170 const unsigned char* command_start = buf_getptr(options_buf, 0); |
171 | |
172 if (ses.authstate.pubkey_options->forced_command) { | |
173 /* multiple command= options */ | |
174 goto bad_option; | |
175 } | |
176 | |
172 while (options_buf->pos < options_buf->len) { | 177 while (options_buf->pos < options_buf->len) { |
173 const char c = buf_getbyte(options_buf); | 178 const char c = buf_getbyte(options_buf); |
174 if (!escaped && c == '"') { | 179 if (!escaped && c == '"') { |
175 const int command_len = buf_getptr(options_buf, 0) - command_start; | 180 const int command_len = buf_getptr(options_buf, 0) - command_start; |
176 ses.authstate.pubkey_options->forced_command = m_malloc(command_len); | 181 ses.authstate.pubkey_options->forced_command = m_malloc(command_len); |