Skip to content
Snippets Groups Projects
Commit 421208e1 authored by rswindell's avatar rswindell
Browse files

Fix expandtofit() and thus getdelim() (used by SBBSecho as of Oct-29-2013)

for all builds using 32-bit longs due to numeric integer overflow as reported
by GCC ("warning: integer overflow in expression")
and MSVC ("warning C4307: '+' : integral constant overflow")
thus causing expandtofit() to always return -1 and getdelim() to always fail.
parent fa5676e0
No related branches found
No related tags found
No related merge requests found
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2010 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2014 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License *
......@@ -303,7 +303,7 @@ static int expandtofit(char **linep, size_t len, size_t *linecapp)
char *newline;
size_t newcap;
if(len > LONG_MAX + 1)
if(len+1 >= LONG_MAX)
return -1;
if(len > *linecapp) {
if(len == LONG_MAX + 1)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment