summaryrefslogtreecommitdiffstats
path: root/kernel/drivers/s390/char/con3270.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/drivers/s390/char/con3270.c')
-rw-r--r--kernel/drivers/s390/char/con3270.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/kernel/drivers/s390/char/con3270.c b/kernel/drivers/s390/char/con3270.c
index 7c511add5..bae98521c 100644
--- a/kernel/drivers/s390/char/con3270.c
+++ b/kernel/drivers/s390/char/con3270.c
@@ -124,7 +124,12 @@ con3270_create_status(struct con3270 *cp)
static void
con3270_update_string(struct con3270 *cp, struct string *s, int nr)
{
- if (s->len >= cp->view.cols - 5)
+ if (s->len < 4) {
+ /* This indicates a bug, but printing a warning would
+ * cause a deadlock. */
+ return;
+ }
+ if (s->string[s->len - 4] != TO_RA)
return;
raw3270_buffer_address(cp->view.dev, s->string + s->len - 3,
cp->view.cols * (nr + 1));
@@ -461,11 +466,11 @@ con3270_cline_end(struct con3270 *cp)
cp->cline->len + 4 : cp->view.cols;
s = con3270_alloc_string(cp, size);
memcpy(s->string, cp->cline->string, cp->cline->len);
- if (s->len < cp->view.cols - 5) {
+ if (cp->cline->len < cp->view.cols - 5) {
s->string[s->len - 4] = TO_RA;
s->string[s->len - 1] = 0;
} else {
- while (--size > cp->cline->len)
+ while (--size >= cp->cline->len)
s->string[size] = cp->view.ascebc[' '];
}
/* Replace cline with allocated line s and reset cline. */