diff --git a/selection.c b/selection.c index 602377f..54db131 100644 --- a/selection.c +++ b/selection.c @@ -472,8 +472,11 @@ LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len) } maxlen = (h->rows * (h->cols+1)) - offset; - if(maxlen <= 0 || offset < 0) + if(maxlen <= 0 || offset < 0) + { + errno = EINVAL; return NULL; + } if(len < 0 || len > maxlen) len = maxlen; -- libgit2 0.21.2