[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nano-devel] nano 2.1.8pre1

From: Mike Frysinger
Subject: Re: [Nano-devel] nano 2.1.8pre1
Date: Sat, 31 Jan 2009 10:16:50 -0500
User-agent: KMail/1.10.4 (Linux/2.6.28; KDE/4.1.4; x86_64; ; )

On Friday 30 January 2009 21:28:07 Chris Allegretta wrote:
> Available for your testing.  Don't worry about color syntax speed getting
> even slower, the plan is to fix that before the final 2.1.8 but I shouldn't
> need to change any translatable strings to do so.

the following file triggers a segfault ... perhaps related to color 
highlighting as i have the default C highlighting enabled.

$nano test.c
#define _GNU_SOURCE
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
static inline char *sb_strndup(const char *str, size_t n)
    size_t r;
    for (r = 0; r < n; ++r)
        if (!str[r])

    char *ret = malloc(r + 1);
    memcpy(ret, str, r);
    ret[r] = '\0';
        printf("%zu \n", r);
    return ret;
int main(int argc, char *argv[])
        char *a, *b;
        char *base = argc == 1 ? argv[0] : argv[1];
        printf("base: %i '%s'\n", argc, base);

        size_t n = strlen(base) + 3;

        while (n) {
                printf("n:%zu ", n);
                a = strndup(base, n);
                b = sb_strndup(base, n);
                printf("'%s'\n'%s'\n\n", a, b);

        return 0;

Attachment: signature.asc
Description: This is a digitally signed message part.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]