Fix broken validation for bm*

work
Ondřej Hruška 7 years ago
parent 0e6c297fe4
commit e98588b317
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 2
      front-end
  2. 12
      user/screen.c

@ -1 +1 @@
Subproject commit c8305dea1a9ab38a13de442152c1fb9819bf68b1 Subproject commit cf29deaa0cf6fa4dc600c0684b009f4ec02ce5e7

@ -217,6 +217,7 @@ xget_term_bm(char *buff, char *value)
char c; char c;
char *bp = buff; char *bp = buff;
char *cp = value; char *cp = value;
buff[0] = 0;
int n = 0; int n = 0;
while((c = *cp++) != 0) { while((c = *cp++) != 0) {
if(n>0) { if(n>0) {
@ -254,7 +255,7 @@ xset_term_bm(const char *name, char *field, const char *buff, const void *arg)
return XSET_FAIL; return XSET_FAIL;
} }
// cgi_dbg("acu %d", acu); dbg("+ %c", acu);
buff_bm[char_i++] = (char)acu; buff_bm[char_i++] = (char)acu;
// prepare for next char // prepare for next char
@ -273,11 +274,16 @@ xset_term_bm(const char *name, char *field, const char *buff, const void *arg)
cgi_warn("Required!"); cgi_warn("Required!");
return XSET_FAIL; return XSET_FAIL;
} }
if (!lastsp) { if (!lastsp&&acu>0) {
dbg("+ %c", acu);
buff_bm[char_i++] = (char)acu; buff_bm[char_i++] = (char)acu;
} }
buff_bm[char_i] = 0; buff_bm[char_i] = 0;
// cgi_dbg("%s, chari = %d", buff_bm, char_i);
if (char_i == 0) {
cgi_warn("Required!");
return XSET_FAIL;
}
if (!streq(field, buff_bm)) { if (!streq(field, buff_bm)) {
strncpy(field, buff_bm, TERM_BTN_MSG_LEN); strncpy(field, buff_bm, TERM_BTN_MSG_LEN);

Loading…
Cancel
Save