mailing list of musl libc
 help / color / mirror / code / Atom feed
From: <writeonce@midipix.org>
To: musl@lists.openwall.com
Subject: validation of utf-8 strings passed as system call arguments
Date: Thu, 12 Dec 2013 21:30:06 -0700	[thread overview]
Message-ID: <20131212213006.dc30d64f61e5ec441c34ffd4f788e58e.381c744cf1.wbe@email22.secureserver.net> (raw)

[-- Attachment #1: Type: text/html, Size: 1039 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: open__ill_formed_utf8.c --]
[-- Type: text/x-c; name="open__ill_formed_utf8.c";, Size: 455 bytes --]

#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>

int main (int argc, char * argv[], char * envp[])
{
	char path[] = {0xE0, 0x9F, 0x80, 0x00};
	mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH;

	int fd = open (path, O_WRONLY | O_EXCL | O_CREAT, mode);
	
	if (fd == -1) {
		perror ("open");
		return 2;
	} else {
		printf("It worked! The file descriptor is %d.\n",fd);
	}
	
	return 0;
}


             reply	other threads:[~2013-12-13  4:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-13  4:30 writeonce [this message]
2013-12-13  4:39 ` Rich Felker
2013-12-13  6:36   ` Szabolcs Nagy
2013-12-13  6:49     ` Rich Felker
2013-12-13 12:11 ` Luca Barbato
2013-12-13 12:52 writeonce
2013-12-13 17:28 ` Rich Felker
2013-12-13 18:57 writeonce
2013-12-13 19:46 ` Rich Felker
2013-12-13 20:23 writeonce

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131212213006.dc30d64f61e5ec441c34ffd4f788e58e.381c744cf1.wbe@email22.secureserver.net \
    --to=writeonce@midipix.org \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).