]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Wordlen should be a size_t, not an int 684/head
authorRose <83477269+AtariDreams@users.noreply.github.com>
Thu, 11 May 2023 17:47:09 +0000 (13:47 -0400)
committerRose <83477269+AtariDreams@users.noreply.github.com>
Fri, 12 May 2023 15:39:40 +0000 (11:39 -0400)
text is always more than or equal to ptr, so it will never underflow.

cgi-bin/help-index.c

index 3da1010e6a2985c7520e39381f8cd39bb3c6c9b1..4a10235f33748f6249a5767dc2e19e6407127da6 100644 (file)
@@ -851,7 +851,7 @@ help_load_file(
   off_t                offset;                 /* File offset */
   char         quote;                  /* Quote character */
   help_word_t  *word;                  /* Current word */
-  int          wordlen;                /* Length of word */
+  size_t               wordlen;                /* Length of word */
 
 
   if ((fp = cupsFileOpen(filename, "r")) == NULL)
@@ -1136,9 +1136,9 @@ help_load_file(
 
        for (text = ptr, ptr ++; *ptr && isalnum(*ptr & 255); ptr ++);
 
-       wordlen = (int)(ptr - text);
+       wordlen = (size_t)(ptr - text);
 
-        memcpy(temp, text, (size_t)wordlen);
+        memcpy(temp, text, wordlen);
        temp[wordlen] = '\0';
 
         ptr --;