]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
Options of type CURLOPTTYPE_FUNCTIONPOINT are never printable.
authorGisle Vanem <gvanem@broadpark.no>
Fri, 26 Jan 2007 15:15:27 +0000 (15:15 +0000)
committerGisle Vanem <gvanem@broadpark.no>
Fri, 26 Jan 2007 15:15:27 +0000 (15:15 +0000)
src/main.c

index ab5bbc5950b7fa53b1f5345c63dc4e42666b124c..4867d1a0ec3352f6383b4f0937b38c0854d9f52a 100644 (file)
@@ -3225,13 +3225,21 @@ CURLcode _my_setopt(CURL *curl, const char *name, CURLoption tag, ...)
 
   }
   else if(tag < CURLOPTTYPE_OFF_T) {
-    /* we treat both object and function pointers like this */
     void *pval = va_arg(arg, void *);
     unsigned char *ptr = (unsigned char *)pval;
 
+    /* function pointers are never printable */
+    if (tag >= CURLOPTTYPE_FUNCTIONPOINT) {
+      if (pval) {
+        snprintf(value, sizeof(value), "%p", pval);
+        remark = TRUE;
+      }
+      else
+        strcpy(value, "NULL");
+    }
     /* attempt to figure out if it is a string (since the tag numerical doesn't
        offer this info) and then output it as a string if so */
-    if(pval && isgraph(ptr[0]) && isgraph(ptr[1]))
+    else if(pval && isgraph(ptr[0]) && isgraph(ptr[1]))
       snprintf(value, sizeof(value), "\"%s\"", (char *)ptr);
     else if(pval) {
       snprintf(value, sizeof(value), "%p", pval);