Fossil SCM

Adjust the captcha to use light-gray blocks instead of spaces for the background, to work around issues with systems where a space is smaller than a unicode block character. [forum:/forumpost/839b3b6fef|Forum post 839b3b6fef].

drh 2026-05-08 16:35 UTC trunk
Commit 20c579e435ef8c4f0825220a7e8fad0391a0569a4acce38a01866b2d883788a6
1 file changed +7 -3
+7 -3
--- src/captcha.c
+++ src/captcha.c
@@ -129,11 +129,11 @@
129129
** Render an 8-character hexadecimal string as ascii art.
130130
** Space to hold the result is obtained from malloc() and should be freed
131131
** by the caller.
132132
*/
133133
char *captcha_render(const char *zPw){
134
- char *z = fossil_malloc( 160*strlen(zPw) + 9 );
134
+ char *z = fossil_malloc( 224*strlen(zPw) + 9 );
135135
int i, j, k, m;
136136
137137
k = 0;
138138
for(i=0; i<7; i++){
139139
for(j=0; zPw[j]; j++){
@@ -146,12 +146,16 @@
146146
z[k++] = 0x88;
147147
z[k++] = 0xe2;
148148
z[k++] = 0x96;
149149
z[k++] = 0x88;
150150
}else{
151
- z[k++] = ' ';
152
- z[k++] = ' ';
151
+ z[k++] = 0xe2;
152
+ z[k++] = 0x96;
153
+ z[k++] = 0x91;
154
+ z[k++] = 0xe2;
155
+ z[k++] = 0x96;
156
+ z[k++] = 0x91;
153157
}
154158
}
155159
z[k++] = ' ';
156160
z[k++] = ' ';
157161
}
158162
--- src/captcha.c
+++ src/captcha.c
@@ -129,11 +129,11 @@
129 ** Render an 8-character hexadecimal string as ascii art.
130 ** Space to hold the result is obtained from malloc() and should be freed
131 ** by the caller.
132 */
133 char *captcha_render(const char *zPw){
134 char *z = fossil_malloc( 160*strlen(zPw) + 9 );
135 int i, j, k, m;
136
137 k = 0;
138 for(i=0; i<7; i++){
139 for(j=0; zPw[j]; j++){
@@ -146,12 +146,16 @@
146 z[k++] = 0x88;
147 z[k++] = 0xe2;
148 z[k++] = 0x96;
149 z[k++] = 0x88;
150 }else{
151 z[k++] = ' ';
152 z[k++] = ' ';
 
 
 
 
153 }
154 }
155 z[k++] = ' ';
156 z[k++] = ' ';
157 }
158
--- src/captcha.c
+++ src/captcha.c
@@ -129,11 +129,11 @@
129 ** Render an 8-character hexadecimal string as ascii art.
130 ** Space to hold the result is obtained from malloc() and should be freed
131 ** by the caller.
132 */
133 char *captcha_render(const char *zPw){
134 char *z = fossil_malloc( 224*strlen(zPw) + 9 );
135 int i, j, k, m;
136
137 k = 0;
138 for(i=0; i<7; i++){
139 for(j=0; zPw[j]; j++){
@@ -146,12 +146,16 @@
146 z[k++] = 0x88;
147 z[k++] = 0xe2;
148 z[k++] = 0x96;
149 z[k++] = 0x88;
150 }else{
151 z[k++] = 0xe2;
152 z[k++] = 0x96;
153 z[k++] = 0x91;
154 z[k++] = 0xe2;
155 z[k++] = 0x96;
156 z[k++] = 0x91;
157 }
158 }
159 z[k++] = ' ';
160 z[k++] = ' ';
161 }
162

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button