mirror of
https://github.com/tmate-io/tmate-ssh-server.git
synced 2020-11-18 19:53:51 -08:00
Don't return NULL when retrieving a string that is too long.
This commit is contained in:
parent
ed5e8c4cd9
commit
4ebb85aae8
5
input.c
5
input.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: input.c,v 1.70 2009-01-07 22:52:33 nicm Exp $ */
|
/* $Id: input.c,v 1.71 2009-01-08 21:22:01 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -202,10 +202,9 @@ input_get_string(struct input_ctx *ictx)
|
|||||||
{
|
{
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
if (ictx->string_buf == NULL)
|
if (ictx->string_buf == NULL || input_add_string(ictx, '\0') != 0)
|
||||||
return (xstrdup(""));
|
return (xstrdup(""));
|
||||||
|
|
||||||
input_add_string(ictx, '\0');
|
|
||||||
s = ictx->string_buf;
|
s = ictx->string_buf;
|
||||||
ictx->string_buf = NULL;
|
ictx->string_buf = NULL;
|
||||||
return (s);
|
return (s);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: screen-write.c,v 1.19 2009-01-06 18:07:57 nicm Exp $ */
|
/* $Id: screen-write.c,v 1.20 2009-01-08 21:22:01 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -139,6 +139,7 @@ screen_write_cursorup(struct screen_write_ctx *ctx, u_int ny)
|
|||||||
if (ny == 0)
|
if (ny == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
log_debug("cursor up: %u + %u", s->cy, ny);
|
||||||
s->cy -= ny;
|
s->cy -= ny;
|
||||||
|
|
||||||
if (ctx->write != NULL)
|
if (ctx->write != NULL)
|
||||||
@ -159,6 +160,7 @@ screen_write_cursordown(struct screen_write_ctx *ctx, u_int ny)
|
|||||||
if (ny == 0)
|
if (ny == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
log_debug("cursor down: %u + %u", s->cy, ny);
|
||||||
s->cy += ny;
|
s->cy += ny;
|
||||||
|
|
||||||
if (ctx->write != NULL)
|
if (ctx->write != NULL)
|
||||||
@ -179,6 +181,7 @@ screen_write_cursorright(struct screen_write_ctx *ctx, u_int nx)
|
|||||||
if (nx == 0)
|
if (nx == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
log_debug("cursor right: %u + %u", s->cx, nx);
|
||||||
s->cx += nx;
|
s->cx += nx;
|
||||||
|
|
||||||
if (ctx->write != NULL)
|
if (ctx->write != NULL)
|
||||||
@ -199,6 +202,7 @@ screen_write_cursorleft(struct screen_write_ctx *ctx, u_int nx)
|
|||||||
if (nx == 0)
|
if (nx == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
log_debug("cursor left: %u + %u", s->cx, nx);
|
||||||
s->cx -= nx;
|
s->cx -= nx;
|
||||||
|
|
||||||
if (ctx->write != NULL)
|
if (ctx->write != NULL)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user