Skip to content
Snippets Groups Projects
Commit 9ae5d681 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

The QWK reset sub ptr command would never work

Caught by Coverity-scan CID 33178
parent 489267ad
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
......@@ -689,6 +689,11 @@ void sbbs_t::qwksetptr(uint subnum, char *buf, int reset)
long l;
uint32_t last;
if(reset && !IS_DIGIT(*buf)) {
getlastmsg(subnum,&(subscan[subnum].ptr),/* time_t* */NULL);
return;
}
if(buf[2]=='/' && buf[5]=='/') { /* date specified */
time_t t=dstrtounix(&cfg,buf);
subscan[subnum].ptr=getmsgnum(subnum,t);
......@@ -697,15 +702,13 @@ void sbbs_t::qwksetptr(uint subnum, char *buf, int reset)
l=atol(buf);
if(l>=0) /* ptr specified */
subscan[subnum].ptr=l;
else if(l) { /* relative ptr specified */
else { /* relative (to last msg) ptr specified */
getlastmsg(subnum,&last,/* time_t* */NULL);
if(-l>(long)last)
subscan[subnum].ptr=0;
else
subscan[subnum].ptr=last+l;
}
else if(reset)
getlastmsg(subnum,&(subscan[subnum].ptr),/* time_t* */NULL);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment